0

hello
sorry to trouble you, i was wondering if you could see this program on this c++ program. i want to have a program were i can enter two intergers to make a cetain grade i.e.

56 +4
>60="c" for example, any please look at my program.

#include <iostream> 
#include <iomanip> 
using namespace std; 
int main() 
{ 
// Declarations: 
 
int iNumGrade; // Numeric grade to be obtained from user 
// Get value from user: 
cout << "Enter the numeric grade: " << endl; 
cin >> iNumGrade; 
 
// Determine the letter grade: 
if (iNumGrade >= 90) 
cout << "A"; 
else if (iNumGrade >= 80) 
cout << "B"; 
else if (iNumGrade >= 70) 
cout << "C"; 
else if (iNumGrade >= 60) 
cout << "D"; 
else 
cout << "F"; 
// Add a blank line: 
cout << endl; 
// End application: 
return 0;
4
Contributors
3
Replies
4
Views
10 Years
Discussion Span
Last Post by rinoa04
0

> cin >> iNumGrade;
So perhaps

cin >> iNumGrade >> iAnotherGrade; 
int iTotal = iNumGrade + iAnotherGrade;

Or do you want to specifically extract the '+' as well?

0

You're also missing a closing curly brace } at the end of your program, but that's probably just a typo.

0

Your coding only accept one integer. You will need to modify your coding to make it accept two integers a and b. Then get the total of the two integers before determining the grade.

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.