- 8

Write a C++ program that determines a student’s grade. The program will read three types of scores: (First Exam, Second Exam, an

Write a C++ program that determines a student’s grade. The program will read three types of scores: (First Exam, Second Exam, and Final Exam) and determine the grade based on the following rules: ·         The grade is A if  Total score >= 90% ·         The grade is B if  Total score >= 70% and <90% ·         The grade is C if  Total score >= 50% and <70% ·         The grade is F if  Total score <  50%

24th Nov 2016, 3:46 PM
Jdhdhsjjehdg Jdhdhsjskdn
Jdhdhsjjehdg Jdhdhsjskdn - avatar
7 odpowiedzi
+ 3
the function which returns grade as it said on putting score percentage to be used will be str grade(score){ str grades=''; if(score>=.90) grades="a"; else{ if(score>=70 && score<90) grades="b"; else { if( score>=50 & & score<70) grades="c"; else grades="d } } } return grades; } now you can use that function on int main(); I thought of using switch first but we have to use greater than and less than here so problem will be difficult while using switch the syntax is case <value of variable>: statements to be executed if variable is found equal to the value Also there is need of break and continue for these problems
24th Nov 2016, 5:51 PM
Sandeep Chatterjee
+ 2
Firstly u have to take the marks input from user and then you can use this logic switch(marks/10)    {        case 10 :        case 9 :            /* Marks between 90-100 */            printf("Your Grade : A\n" );            break;        case 8 :        case 7 :            /* Marks between 70-89 */            printf("Your Grade : B\n" );            break;        case 6 :            /* Marks between 60-69 */            printf("Your Grade : C\n" );            break;        case 5 :        case 4 :            /* Marks between 40-59 */            printf("Your Grade : D\n" );            break;        default :            /* Marks less than 40 */            printf("You failed\n" );    }
24th Nov 2016, 6:20 PM
Madhuri Sh@h
Madhuri Sh@h - avatar
+ 1
switch(average/10) { case 9 : cout << "A"; break; case 8 : case 7 : cout << "B"; break; case 6 : case 5 : cout << "C"; break; default : cout << "D"; } Here is the full C++ program http://www.techcrashcourse.com/2017/01/cpp-program-calculate-grade-of-student.html http://www.techcrashcourse.com/2015/05/c-programming-switch-statement.html
14th Apr 2017, 5:43 PM
Arun Kumar
Arun Kumar - avatar
0
Alrighty, I'm not going to do the code for you, but I'll help you map it out. First, you'll need to ask the user for three scores, which will be stored as separate variables by your program. If you don't know how to do this, here is a lovely tutorial: http://www.cplusplus.com/doc/tutorial/basic_io/ (ex. cin>> firstScore) You will then need to add those variables together. Afterwards, divide them be three. Store that number by another variable. (ex. finalScore = firstScore + secondScore + thirdScore/ 3). Afterwards, create if/then statements that tests the finalScore to see where it lies in the grade spectrum. (ex. if (finalScore >= 90) { blah } to start). Another great tutorial is here: http://www.cprogramming.com/tutorial/lesson2.html Word of advice, please at least attempt to code the program yourseld first and show us that, then explain what the issue is. It is much easier to coach someone's programming when we can see it, and it will help you learn better :)
24th Nov 2016, 4:23 PM
Hazel "Joey" Pickett
Hazel "Joey" Pickett - avatar
0
Jjk
21st Jan 2024, 4:12 PM
Ram Subhavan
Ram Subhavan - avatar
0
give the answer
20th Jul 2024, 5:32 PM
SANJEE VANI M 23CSR138
SANJEE VANI M 23CSR138 - avatar
0
give your answer
21st Jul 2024, 1:48 PM
SANJEE VANI M 23CSR138
SANJEE VANI M 23CSR138 - avatar