Skip to content

Instantly share code, notes, and snippets.

@2hanX
Last active June 16, 2020 09:48
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save 2hanX/77c628bf554f1c578c31119df61c50d8 to your computer and use it in GitHub Desktop.
Save 2hanX/77c628bf554f1c578c31119df61c50d8 to your computer and use it in GitHub Desktop.
#include<iostream>
#include<string>
using namespace std;
struct student
{
string fname, lname;
char grade;
int age;
};
void display(student su)
{
cout << "Name: " << su.lname;
cout << ", " << su.fname << "\n";
cout << "Grade: " << char(su.grade+1) << "\n";
cout << "Age: " << su.age << endl;
}
int main()
{
student su;
cout << "What is your first name? ";
getline(cin,su.fname);
cout << "What is your last name? ";
getline(cin,su.lname);
cout << "What letter grade do you deserve? ";
cin >> su.grade;
cout << "What is your age? ";
cin >> su.age;
display(su);
return 0;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment