Grade Program

Please support our C++ advertiser: Intel Parallel Studio Home
Reply

Join Date: Jan 2007
Posts: 1
Reputation: frank12 is an unknown quantity at this point 
Solved Threads: 0
frank12 frank12 is offline Offline
Newbie Poster

Grade Program

 
0
  #1
Jan 19th, 2007
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.
  1. #include <iostream>
  2. #include <iomanip>
  3. using namespace std;
  4. int main()
  5. {
  6. // Declarations:
  7.  
  8. int iNumGrade; // Numeric grade to be obtained from user
  9. // Get value from user:
  10. cout << "Enter the numeric grade: " << endl;
  11. cin >> iNumGrade;
  12.  
  13. // Determine the letter grade:
  14. if (iNumGrade >= 90)
  15. cout << "A";
  16. else if (iNumGrade >= 80)
  17. cout << "B";
  18. else if (iNumGrade >= 70)
  19. cout << "C";
  20. else if (iNumGrade >= 60)
  21. cout << "D";
  22. else
  23. cout << "F";
  24. // Add a blank line:
  25. cout << endl;
  26. // End application:
  27. return 0;
Last edited by WaltP; Jan 20th, 2007 at 2:53 am. Reason: wrong symbol -- and adding code tags, which you can use yourself
Reply With Quote Quick reply to this message  
Join Date: Dec 2005
Posts: 5,850
Reputation: Salem has a reputation beyond repute Salem has a reputation beyond repute Salem has a reputation beyond repute Salem has a reputation beyond repute Salem has a reputation beyond repute Salem has a reputation beyond repute Salem has a reputation beyond repute Salem has a reputation beyond repute Salem has a reputation beyond repute Salem has a reputation beyond repute Salem has a reputation beyond repute 
Solved Threads: 749
Team Colleague
Salem's Avatar
Salem Salem is offline Offline
Void main'ers are DOOMed

Re: Grade Program

 
0
  #2
Jan 19th, 2007
> cin >> iNumGrade;
So perhaps

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


Or do you want to specifically extract the '+' as well?
Reply With Quote Quick reply to this message  
Join Date: Nov 2005
Posts: 251
Reputation: dwks has a spectacular aura about dwks has a spectacular aura about 
Solved Threads: 25
dwks's Avatar
dwks dwks is offline Offline
Posting Whiz in Training

Re: Grade Program

 
0
  #3
Jan 19th, 2007
You're also missing a closing curly brace } at the end of your program, but that's probably just a typo.
dwk

Seek and ye shall find.

"Only those who will risk going too far can possibly find out how far one can go."
-- TS Eliot.

"I have not failed. I've just found 10,000 ways that won't work."
-- Thomas Alva Edison

"The only real mistake is the one from which we learn nothing."
-- John Powell
Reply With Quote Quick reply to this message  
Join Date: Sep 2006
Posts: 84
Reputation: rinoa04 is on a distinguished road 
Solved Threads: 4
rinoa04's Avatar
rinoa04 rinoa04 is offline Offline
Junior Poster in Training

Re: Grade Program

 
0
  #4
Jan 19th, 2007
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.
Reply With Quote Quick reply to this message  
Reply

This thread is more than three months old.
Perhaps start a new thread instead?
Message:



Similar Threads
Other Threads in the C++ Forum
Thread Tools Search this Thread



About Us | Contact Us | Advertise | DaniWeb | Acceptable Use Policy | RSS Feed

©2003 - 2009 DaniWeb® LLC