M$LOL
April 7th, 2007, 05:39 PM
GCC errors:
g++ struct.cpp -Wall -o structs.exe
struct.cpp: In function ‘int main()’:
struct.cpp:16: error: ‘cout’ was not declared in this scope
struct.cpp:16: error: ‘endl’ was not declared in this scope
struct.cpp:17: error: ‘cin’ was not declared in this scope
Here's the source:
#include <iostream>
struct addr
{
char name[30];
char street[40];
char city[20];
char state[3];
unsigned long int zip;
};
int main()
{
struct addr addr_info;
cout << "Enter your name" << endl;
cin >> addr_info.name ;
cout << "Your name is " << addr_info.name << endl;
cin.get();
return 0;
}
Is iostream not working, or am I missing something?
g++ struct.cpp -Wall -o structs.exe
struct.cpp: In function ‘int main()’:
struct.cpp:16: error: ‘cout’ was not declared in this scope
struct.cpp:16: error: ‘endl’ was not declared in this scope
struct.cpp:17: error: ‘cin’ was not declared in this scope
Here's the source:
#include <iostream>
struct addr
{
char name[30];
char street[40];
char city[20];
char state[3];
unsigned long int zip;
};
int main()
{
struct addr addr_info;
cout << "Enter your name" << endl;
cin >> addr_info.name ;
cout << "Your name is " << addr_info.name << endl;
cin.get();
return 0;
}
Is iostream not working, or am I missing something?