-
how do you declare code?
Code:
#include <iostream>
int main()
{
int age;
char string[256];
cout<<"Please enter your name and birthdate: ";
cin>>string>>age;
cout<<"Welcome"<<string<<","<<age<<endl;
system ("pause");
return 0;
}
I get several error of my cout and cin ( and endl) commands being undeclared, but how do you declare something?
-
using namespace std; is your friend
or use the older header, iostream.h
Code:
#include <iostream>
using namespace std;
int main()
{
int age;
char string[256];
cout<<"Please enter your name and birthdate: ";
cin>>string>>age;
cout<<"Welcome"<<string<<","<<age<<endl;
system ("pause");
return 0;
}
-
could you also give me a list of the different streams like iostream and that stuff and what their functions are?
-
i rmemeber a link on here about exactly what your asking, but cant remember it exactyl...looking around now.
edit: this is kinda what your looking for, but not the one im thinking of.
-
"could you also give me a list of the different streams like iostream and that stuff and what their functions are?"
cin--input from your keyboard.
cout--output to your display.
Both are defined in <iostream>.
-
fstream is for files
istringstream is for input stringstreams
ostringstream is for output stringstreams