#include <iostream>
#include <string>
#include <cstring>
using namespace std;

int main()
{
	char name[20];
	string lastName;
	char grade;
	int age;

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

	cout<<"Name: "<<lastName<<", "<<name<<endl;
	cout<<"Grade: "<<grade<<endl;
	cout<<"Age: "<<age<<endl;


	return 0;
}

HELP: If someone request a B than I'm supposed to print a C. If someone request a C I print D. F is the last letter. How can I do this?

Chars are really integers (see any ASCII table).

char grade = 'A';
grade++;
std::cout<<grade;  //'B'

but this requires you to go up when you are going down in grades, and the skip between D and F would require some extra logic.
What would be even easier, though, is to make it a case statement

switch(grade)
{
    case 'A': grade = 'B';
              break;
   //similar for case 'B'
   //similar for case 'C'
   //cases for 'D' and 'F' are different
   default: //what do we do if it's none of these letters
}

If someone request a B than I'm supposed to print a C. If someone request a C I print D.

What a cynical design. So you'll always assume that the student is lying to get a better grade, always deserves a lower grade, and an A will never be given? :icon_rolleyes:

Comments
you didn't answer my question but I liked that you tried to help
How is this pertinent to the question? ;)
This article has been dead for over six months. Start a new discussion instead.