cin problem

hey

ı tried to work this code

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
#include <iostream>

using namespace std;

int main()
{
	string name;
	int age;
	string Lname;
	cout << "Enter your name" << endl;
	cin >> name;
	cout << "Enter your last name" << endl;
	cin >> Lname;
	cout << "Enter your age" << endl;
	cin >> age;
	system("PAUSE");
	return 0;


}


but int is working,string's are not how can ı solve this ?
btw ı'm using Visual studio
Last edited on
First thing to do is to add the line
 
#include <string> 

Thank you :D
its really easy
u just make like this
a simple program
1
2
3
4
5
6
7
8
9
10
11
#include <iostream>
using namespace std;

int main()
{
int name[how big is the string or the symbol];
cin >> name;
cout << name;
//if doesnt work try char, but if you have error then i dont know how to help
return 0;
}
Topic archived. No new replies allowed.