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;

Recommended Answers

All 3 Replies

> cin >> iNumGrade;
So perhaps

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

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

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

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.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.