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: 
Use `string name` instead of `char name[20]` to take multi-character value. char name[20] will terminate after taking a single character.

Also, its valued will not be displayed on giving output.

Modified code for reference.

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

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

//test output
void put(){
    cout<<name<<endl;
    cout<<age<<endl;
}
};
int main(){
    user u;
    u.get();
    //test
    u.put();
    return 0;
}

```
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 :)