Need HELP!

This is my prompt:
Prompt, input student's name (first name only, which will consist of one word only) and score. C&d on input failure. Let's say that the score might have a fractional part, so input the score into a double variaible. Calculate and output the student's grade according to
>= 85 A
[75, 85) B
[65, 75) C
(50, 65) D
<= 50 F
EXCEPT that if a student's name is my name (Bob) or your name and the student earns less than an A, that student gets the next higher grade.

I GOT EVERYTHING, EXCEPT THE RAISING A GRADE THING if your name is Bob or my name. Help please!?

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
  #include <iostream>
#include <cmath>
#include <cstdlib>
#include <string>
using namespace std;

bool die( const string & msg );

int main() {
    
    string name;
    double score;
    char grade;
    
    cout << "Enter Name & Score: " << endl;
    
    cin >> name;
    if( cin.fail() )  die( "input failure" );
    
    cin >> score;
    if( cin.fail() )  die( "input failure" );
    
    grade = 0;
    
    if (score >= 85)
        grade = 'A';
    else if (score >= 75)
        grade = 'B';
    else if (score >= 65)
        grade = 'C';
    else if (score >= 50)
        grade = 'D';
    else if (score < 50)
        grade = 'F';
    
    cout << name << " gets a " << grade << endl;
    
}

bool die( const string & msg ){
    cout <<"Fatal error: " <<msg <<endl;
    exit( EXIT_FAILURE );
}
There are a couple ways you could go about it. One, you could add another if block and add
1
2
3
4
5
6
if(name == "Bob" || name == "MyName")
   {
        if(grade == 'B')
            grade = 'A';
        ...
   }

Or, you could add to your existing if block.
1
2
if(score >= 85 || (name == "Bob" && score >=75)  || (name == "MyName" && score >= 75 )
   grade = 'A';


I'm sure there are other ways, but here are two.
Thanks so much!
Topic archived. No new replies allowed.