473,486 Members | 2,136 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

Calculate Grade

4 New Member
I have completed most of the program I just cant get the letter grade to print from the void printGrade function.The output of the program should be:

Line 1: Based on the course score, this program computes the course grade.
Line 4: Enter course score:_

Line 6: Course score is:_
Line 7: Your grade for ths course is_

here is the program:

#include <iostream>
using namespace std;

int getScore(int& score);
void printGrade(int cScore);

int main()
{
int cScore;
int score;

cout << "Line 1: Based on the course score, \n"
<< " this program computes the "
<< "course grade." <<endl;

cScore = getScore(score);
printGrade(cScore);

}

int getScore(int& score)
{
cout << "Line 4: Enter course score: ";
cin >> score;
cout << endl << "Line 6: Course score is "
<< score << endl;

system("PAUSE");
return score;
}

void printGrade(int cScore)
{
cout << "Line 7: Your grade for the course is ";

if (cScore >=90)
cout << "A." << endl;
else if (cScore >= 80)
cout << "B." << endl;
else if (cScore >= 70)
cout << "C." << endl;
else if (cScore >= 60)
cout << "D." << endl;
else
cout << "F." << endl;

}



thanks for the help in advance
Oct 20 '08 #1
3 4398
JosAH
11,448 Recognized Expert MVP
What does that function print instead? It should print something ...

kind regards,

Jos
Oct 20 '08 #2
blamp
4 New Member
Nothing comes up, it's suppose to print the letter grade that goes with the course score.
Oct 20 '08 #3
JosAH
11,448 Recognized Expert MVP
Remove these lines from that other function:

Expand|Select|Wrap|Line Numbers
  1. system("PAUSE"); 
  2. return score;
  3.  
kind regards,

Jos
Oct 20 '08 #4

Sign in to post your reply or Sign up for a free account.

Similar topics

53
5652
by: Cardman | last post by:
Greetings, I am trying to solve a problem that has been inflicting my self created Order Forms for a long time, where the problem is that as I cannot reproduce this error myself, then it is...
35
3126
by: Henry | last post by:
I was doing this program for an exercise in a book. The point was to create a program that would take a numerical grade from a user and convert it to a letter grade (yeah really easy). I tried to...
0
2069
by: Racqetsports | last post by:
Hi there, In a gradebook database, student grades must be computed from 2 scores: a Daily grade, and then scores from Assignments. Knowing about nested forms, I am requesting direction on how to...
4
7376
by: Madmartigan | last post by:
Hello I have attempted the source code from Chapter 4 in Accelerated C++ page 70 but keep getting the above error. I'm not sure whether it is in the way I have saved the header files or because my...
1
3495
by: tonytj | last post by:
This program will read in studentID (3 digit integer number), three quizzes score, four assignments score and two tests scores. Each of the quizzes, assignments, and tests has up to 100 points. The...
1
2833
by: shalit.dror | last post by:
I have an XML files that contains grades in different subjects from year 2005  2007 . In the HTML file I have several drop down list that contain all the names of the subjects. If I select for...
3
4859
by: hanie | last post by:
a student wants to know his grade average for the semester. the grades are give in letter grades with numeric equivalents. develop a solution to calculate a grade average given the letter grades(the...
0
1852
by: ceckerty | last post by:
I have a project I am working on and have hit a road block. This is what the program must accomplish: The Windows application opens with a text box where the user enters their SSN and 4 seperate...
0
7100
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
6964
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
7126
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
7330
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
5434
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
3070
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...
0
3070
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
1378
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...
1
598
muto222
php
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.