Question: The code below,works fine but it does not take any value for age and terminates.`

```
#include <iostream>
#include <string>
using namespace std;
class user{
    int id,level=1,kills=0,age;
    char name[20],server[40];
public:

void get(){
    cout<<"Enter your name:";
    cin>>name[20];
    cout<<"Enter your age:";
    cin>>age;

}
};
int main(){
    user u;
    u.get();
    return 0;
}
/*Output
Enter your name:Jack
Enter your age:
C:\Users\user\documents\c++
*/

```

In the output section ,age is not accepted and the program terminates.

Answer: 
Just modify the code to this :

```
#include <iostream>
#include <string>
using namespace std;
class user{
    int id,level=1,kills=0,age;
    char name[20],server[40];
public:

void get(){
    cout<<"Enter your name:";
    cin>>name; // changes done here
    cout<<"Enter your age:";
    cin>>age;

}
};
int main(){
    user u;
    u.get();
    return 0;
}

```

Job Done :)
The easiest way to handle strings (a long sequence of characters) or even the strings that have spaces just use the following library in C++.

```
#include <bits/stdc++.h>

```

Then just declare a string variable.

```
String name;

```

Now you can save a very long string without any error. e.g.

```
name = jshkad skshdur kslsjue djsdf2341;

```

and you'll get no error, enjoy ;)