beginner's road test but error C2679

Below is my "second hello world" program, but I got complaint by ">>" (line no 9) , how can I fix this?

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
#include <iostream>
using namespace std;

//to see how the input is taken
int main(){
	string firstname, lastname, middlename;
	double age;
	cout << "enter your name:"<<endl;
	cin >> firstname >> middlename >> lastname[output][/output];
	cout << "enter your age:\n";
	cin >> age;
	cout << "age is " << age << endl;
	system("pause");
	printf ("age is %d\n", age);
	return 0;
}
Last edited on
You should include header <string>.
Last edited on
Thank you!!
I have thought string is one of the default type included in the default setting just like int, char....

Topic archived. No new replies allowed.