Your Mathematic school teacher want to use a program that can read the name and the mark of a student. Your teacher want the program to automatically find the grade of the mark and display the result(name, mark and grade). Help your teacher to develop a program that can solve his problem.
The grading is as follow
80 – 100 A
60 – 79 B
40 – 59 C
0 – 39 D
1
Expert's answer
2012-10-09T08:50:41-0400
#include<iostream.h>
char name[50], grade; int mark;
void main(){ cout<<"Enter the name of a student: "; cin>>name; cout<<"Enter the mark of a student: "; cin>>mark; grade = 'A'; if (mark<80) grade = 'B'; if (mark<60) grade = 'C'; if (mark<40) grade = 'D'; cout<<"Student: "<<name<<"\nMark: "<<mark<<"\nGrade: "<<grade<<"\n"; }
Comments
Leave a comment