Code:
[COLOR="Lime"]// ******************************************************* //
// Program to grasp the idea of the getline function //
// ****************************************************** //[/COLOR]
#include <iostream>
#include <string>
using namespace std;
int main ()
{
int age;
string zipcode,name,address;
cout << "Please enter your name\n";
getline(cin,name);
cout << "Please enter your age\n";
cin >> age;
cout << "Please enter your zipcode\n";
cin >> zipcode;
cout << "Please enter your address\n";
getline(cin,address);
cout << "Your details : ";
cout << name;
cout << age << " years old.";
cout << address;
cout << zipcode "\n";
return 0;
}
This is the error I get when run in terminal
address.cpp: In function ‘int main()’:
address.cpp:28: error: expected `;' before string constant (line 27 is cout << address;)
make: *** [address] Error 1
Cheers
Last edited: