Answer to Question #58959 in C++ for hussam
2016-04-06T18:51:13-04:00
The output should be like this
Name ID First Second Final Sum Grade
Ali 20071156 15.5 16.5 30.1 62.1 D
how i can do like this porogram
1
2016-04-07T11:29:04-0400
#include <iostream> #include <string> using namespace std; struct Student{ string name; int id; double first; double second; double finalScore; double sum; char grad; Student() { } Student(string name, int id, double first, double second, double finalScore) { this->name = name; this->id = id; this->first = first; this->second = second; this->finalScore = finalScore; sum = first + second + finalScore; if (grad >= 90) { grad = 'A'; } else { if (grad >= 80) { grad = 'B'; } else { if (grad >= 65) { grad = 'C'; } else { if (grad >= 55) { grad = 'D'; } else { if (grad >= 50) { grad = 'E'; } else { if (grad >= 35) { grad = 'X'; } else { grad = 'F'; } } } } } } } }; int main(void) { Student student = Student("Ali", 20071156, 15.5, 16.5, 30.1); cout << "Name\t" << "ID\t\t" << "First\t" << "Second\t" << "Final\t" << "Sum\t" << "Grade" << endl; cout << student.name << '\t' << student.id << '\t' << student.first << '\t' << student.second << '\t' << student.finalScore << '\t' << student.sum << '\t' << student.grad << endl; }
Need a fast expert's response?
Submit order
and get a quick answer at the best price
for any assignment or question with DETAILED EXPLANATIONS !
Learn more about our help with Assignments:
C++
Comments
Leave a comment