Incomplete char output

Hello,

I would appreciate any help or suggestions with this program.

I'm working from text book exercises and the one that isn't giving the right output is as follows:

int main()
{
using namespace std;

char fName[10];
char sName[10];
char grade;
char age;

cout << "What is your first name? ";
cin.getline(fName, 10);
cout << "What is your last name? ";
cin.getline(sName, 10);
cout << "What letter grade do you deserve? ";
cin >> grade;
cout << "What is your age? ";
cin >> age;

grade = grade + 1;
cout << "Name: " << sName << ", " << fName << endl;
cout << "Grade: " << grade << endl;
cout << "Age: " << age << endl;

return 0;

}

It works fine until the grade output but after that it prints the age with a missing digit.

Thank you
A char can only contain one character (one digit). You probably want the age to be an int.
Yes it was the type, thank you for your help.
Topic archived. No new replies allowed.