Welcome to Dream.In.Code
Become a C++ Expert!

Join 150,157 C++ Programmers for FREE! Get instant access to thousands of C++ experts, tutorials, code snippets, and more! There are 2,369 people online right now. Registration is fast and FREE... Join Now!




Meh numeric_limits<streamsize>::max() not workin ><

 
Reply to this topicStart new topic

Meh numeric_limits<streamsize>::max() not workin ><

maldibion
22 Aug, 2008 - 04:17 PM
Post #1

New D.I.C Head
*

Joined: 14 Aug, 2008
Posts: 7


My Contributions
its that i just chenage from dev cpp to visual c++ 2008 express,real better and more complete but still got many problems on the begging after solving all them i got this new one that i cant solve, so any helps?

CODE
#include "calc.h"// just a header file that have some includes, just a organization stuff
using namespace std;
int main()
{
ini:
char op;
printf("(Calculadora de Medias.)\nVocêe Deseja:\nCalcular Media Bimestral(b)\nSoma das medias(a)\n");
cin >> op;
    switch(op)
    {
              case 'b':
                   {
                        bool flag = false;
                        float n1;
                        float n2;
                        float avd;
                        float mb;
                        inib1:
                        printf("Digite a 1 nota do aluno.\n");
                        cin >> n1;
                        if(!cin.good())
                        {
                         flag = true;
                         printf("Numero Invalido.\n\a");
                        cin.clear();  
                        cin.ignore(numeric_limits<streamsize>::max(),'\n');
//i can just change the numeric blah blah blah to 70 or other number but i still wanna know why i cant use if anyone helps me thx alot =D if u cant thx anyway
                        goto inib1;
                        }
                        else
                        {
                            if(n1>10||n1<0)
                            {
                            printf("Numero Invalido.\n\a");
                            goto inib1;
                            }
                            flag = false;
                        }


that is the error

error C2065: 'numeric_limits' : undeclared identifier
error C2275: 'std::streamsize' : illegal use of this type as an expression
see declaration of 'std::streamsize'
error C2780: 'const _Ty &std::max(const _Ty &,const _Ty &,_Pr)' : expects 3 arguments - 0 provided
see declaration of 'std::max'
error C2780: 'const _Ty &std::max(const _Ty &,const _Ty &)' : expects 2 arguments - 0 provided
see declaration of 'std::max'

i got about 5 or more times these problems

User is offlineProfile CardPM
+Quote Post

NickDMax
RE: Meh Numeric_limits<streamsize>::max() Not Workin ><
22 Aug, 2008 - 08:22 PM
Post #2

2B||!2B
Group Icon

Joined: 18 Feb, 2007
Posts: 2,869



Thanked: 53 times
Dream Kudos: 550
My Contributions
well it helps if you include the proper headers.

#include <iostream> //for cin.
#include <cstdio> //for printf
#include <limits> // for numeric_limits

some compilers let you get away with not including iostream or cstdio but you should really try to include the right headers.

User is offlineProfile CardPM
+Quote Post

gabehabe
RE: Meh Numeric_limits<streamsize>::max() Not Workin ><
23 Aug, 2008 - 02:59 AM
Post #3

better than jam.
Group Icon

Joined: 6 Feb, 2008
Posts: 5,837



Thanked: 104 times
Dream Kudos: 2700
Expert In: slobbing.

My Contributions
They already said that they included them in their header file.

I can't really determine what's causing the errors unless I see the header file.
User is offlineProfile CardPM
+Quote Post

maldibion
RE: Meh Numeric_limits<streamsize>::max() Not Workin ><
23 Aug, 2008 - 06:07 AM
Post #4

New D.I.C Head
*

Joined: 14 Aug, 2008
Posts: 7


My Contributions
bah i forgot about the limits, ><, thx guys =D now this thing its workin
User is offlineProfile CardPM
+Quote Post

Reply to this topicStart new topic
Time is now: 1/9/09 02:40AM

Be Social

Dream.In.Code RSS Feed Dream.In.Code LinkedIn Group Follow Us On Twitter

Live C++ Help!

C++ Tutorials

Reference Sheets

C++ Snippets

DIC Chatroom

Bye Bye Ads

Monthly Drawing

Thumb Drive

Top Contributors

Top 10 Kudos This Month