# Student Grade Calculator

Page 1 of 1

## 2 Replies - 2352 Views - Last Post: 14 October 2009 - 10:12 PMRate Topic: //<![CDATA[ rating = new ipb.rating( 'topic_rate_', { url: 'http://www.dreamincode.net/forums/index.php?app=forums&module=ajax&section=topics&do=rateTopic&t=132088&amp;s=c70dcb28ffd78599f8205dfe97fb0537&md5check=' + ipb.vars['secure_hash'], cur_rating: 0, rated: 0, allow_rate: 0, multi_rate: 1, show_rate_text: true } ); //]]>

### #1 niki9

• New D.I.C Head

Reputation: 0
• Posts: 9
• Joined: 14-October 09

# Student Grade Calculator

Posted 14 October 2009 - 08:16 PM

```#include<ioostream>
#include<iomanip>
using namespace std;

int main ()

{

//Variables

float sum;			//input of grades from the user
float average;      //calculated result

const int NUMBERS = 3;

//Program Purpose

cout << "This programe will determine the final grade of your History tests. You can\n"
<< "drop your lowest test grade. So it will add together the highest of the first\n"
<< "two grades and the third grade."<< endl << endl;

//Prompt the user for the first grade

cout << "\n Please enter the first test grade:  ";
cin.sync();
cin.clear();

//Prompt the user for the second grade

cout << "\n Please enter the second grade:  ";
cin.sync();
cin.clear();

//Prompt the user for the third grade

cout << "\n Please enter the second grade:  ";
cin.sync();
cin.clear();

//Ask the user which grade they would like to drop

cout << "\n Which grade would you like to drop: ";
cin.sync();
cin.clear();

//Display the sum

cout << "The final grade is" << final_grade << endl << endl;

return 0;

}
```

*** MOD EDIT: Added code tags. Please ***

This post has been edited by JackOfAllTrades: 15 October 2009 - 05:15 AM

Is This A Good Question/Topic? 0

## Replies To: Student Grade Calculator

### #2 Ancient Dragon

Reputation: 81
• Posts: 679
• Joined: 19-July 09

## Re: Student Grade Calculator

Posted 14 October 2009 - 08:35 PM

You posed your program -- without using code tags -- but you failed to ask a question.

### #3 barnwillyb

Reputation: 6
• Posts: 108
• Joined: 22-May 07

## Re: Student Grade Calculator

Posted 14 October 2009 - 10:12 PM

niki9, on 14 Oct, 2009 - 07:16 PM, said:

#include<ioostream>
#include<iomanip>
using namespace std;

int main ()

{

//Variables

float sum; //input of grades from the user
float average; //calculated result

const int NUMBERS = 3;

//Program Purpose

cout << "This programe will determine the final grade of your History tests. You can\n"
<< "drop your lowest test grade. So it will add together the highest of the first\n"
<< "two grades and the third grade."<< endl << endl;

//Prompt the user for the first grade

cout << "\n Please enter the first test grade: ";
cin.sync();
cin.clear();

//Prompt the user for the second grade

cout << "\n Please enter the second grade: ";
cin.sync();
cin.clear();

//Prompt the user for the third grade

cout << "\n Please enter the second grade: ";
cin.sync();
cin.clear();

//Ask the user which grade they would like to drop

cout << "\n Which grade would you like to drop: ";
cin.sync();
cin.clear();

//Display the sum

cout << "The final grade is" << final_grade << endl << endl;

return 0;

}

This will get you started:

```/*__________________________________________________________*/
/*																													*/
/*												 includes													*/
/*__________________________________________________________*/

#include <iostream>

// introduces namespace std
using namespace std;

/*__________________________________________________________*/
/*																													*/
/*						prototypes												*/
/*__________________________________________________________*/

char display_student_grades( int student_score );

/*__________________________________________________________*/
/*																													*/
/*											 main listing												*/
/*__________________________________________________________*/

int main ()

{

//Variables

//Program Purpose

cout << "\n\tThis programe will determine the final grade of your History tests. You can\n"
<< "\tdrop your lowest test grade. So it will add together the highest of the first\n"
<< "\ttwo grades and the third grade."<< endl << endl;

//Prompt the user for the first grade

cout << "\tPlease enter the first test grade: ";
cin.sync();
cin.clear();

//Prompt the user for the second grade

cout << "\t\t\tPlease enter the second grade: ";
cin.sync();
cin.clear();

//Prompt the user for the third grade

cout << "\t\t\t Please enter the third grade: ";
cin.sync();
cin.clear();

//Ask the user which grade they would like to drop

cout << "\n\tWhich grade would you like to drop: ";
cin.sync();
cin.clear();

//Display the final grade

cout << "\tThe final grade is " << display_student_grades( final_grade ) << "." << endl;

return 0;

}

/*__________________________________________________________*/
/*																													*/
/*									 function definitions										*/
/*__________________________________________________________*/

// PRINT OUT STUDENT GRADES
char display_student_grades( int student_score ) {
int i;

for (i = 0; i < 10; i++) {
if (student_score >= 90)
return 'A';
else if (student_score >= 79)
return 'B';
else if (student_score >= 69)
return 'C';
else if (student_score >= 62)
return 'D';
else if (student_score < 62)
return 'F';
}
return '0';
}
```

Page 1 of 1

 .related ul { list-style-type: circle; font-size: 12px; font-weight: bold; } .related li { margin-bottom: 5px; background-position: left 7px !important; margin-left: -35px; } .related h2 { font-size: 18px; font-weight: bold; } .related a { color: blue; }