Kidagakash
2004-08-04, 01:35 AM
for some reason i get a compile error on the following.
dont know why, this is an example code from my CD that came with my book i got today. it is supost to work as is, without me chanign anything (witch i havent) but when i go to compile it i get the following error
14 c:\docume~1\kida\desktop\programs\conver~1.cpp
`class _IO_ostream_withassign' has no member named `alpha'
what the hell is going on? this code is in the book and the example is off the CD, and it gets compile error? plz plz plz explain this, try compileing it yourself.
all this code does is look at two number input my th euser, and tells you if they are even by stating true or false.
heres the code..
// BoolTest - compare variables input from the
// keyboard and store the results off
// into a logical variable
#include <cstdio>
#include <cstdlib>
#include <iostream>
using namespace std;
int main(int nNumberofArgs, char* pszArgs[])
{
// set output format for bool variables
// to true and false instead
// of 1 and 0
cout.setf(cout.alpha);
// initialize two arguments
int nArg1;
cout << "Input value 1: ";
cin >> nArg1;
int nArg2;
cout << "Input value 2: ";
cin >> nArg2;
bool b;
b = nArg1 == nArg2;
cout << "The statement, " << nArg1
<< " equals " << nArg2
<< " is " << b
<< endl;
// wait until user is ready before terminating program
// to allow the user to see the program results
system("PAUSE");
return 0;
}
dont know why, this is an example code from my CD that came with my book i got today. it is supost to work as is, without me chanign anything (witch i havent) but when i go to compile it i get the following error
14 c:\docume~1\kida\desktop\programs\conver~1.cpp
`class _IO_ostream_withassign' has no member named `alpha'
what the hell is going on? this code is in the book and the example is off the CD, and it gets compile error? plz plz plz explain this, try compileing it yourself.
all this code does is look at two number input my th euser, and tells you if they are even by stating true or false.
heres the code..
// BoolTest - compare variables input from the
// keyboard and store the results off
// into a logical variable
#include <cstdio>
#include <cstdlib>
#include <iostream>
using namespace std;
int main(int nNumberofArgs, char* pszArgs[])
{
// set output format for bool variables
// to true and false instead
// of 1 and 0
cout.setf(cout.alpha);
// initialize two arguments
int nArg1;
cout << "Input value 1: ";
cin >> nArg1;
int nArg2;
cout << "Input value 2: ";
cin >> nArg2;
bool b;
b = nArg1 == nArg2;
cout << "The statement, " << nArg1
<< " equals " << nArg2
<< " is " << b
<< endl;
// wait until user is ready before terminating program
// to allow the user to see the program results
system("PAUSE");
return 0;
}