Page 1 of 1

## 3 Replies - 1061 Views - Last Post: 09 April 2009 - 10:30 PMRate Topic: //<![CDATA[ rating = new ipb.rating( 'topic_rate_', { url: 'https://www.dreamincode.net/forums/index.php?app=forums&module=ajax&section=topics&do=rateTopic&t=98220&amp;s=67bd851c6a0c498b228908d04aa41f9d&md5check=' + ipb.vars['secure_hash'], cur_rating: 0, rated: 0, allow_rate: 0, multi_rate: 1, show_rate_text: true } ); //]]>

### #1 alexandru80

Reputation: 0
• Posts: 3
• Joined: 09-April 09

Posted 09 April 2009 - 07:09 AM

```#include "stdafx.h"
#include <iostream>
#include <string>

using namespace std;
{
if (score<=100 && score>=90)
{
cout << "You got an A" << endl;
}
else
{
if (score>=80 && score<=89)
{
cout << "You got an B" << endl;
}
else
{
if (score>=70 && score<=79)
{
cout << "You got an C" << endl;
}
else
{
if (score>=60 && score<=69)
{
cout << "You got an D" << endl;
}
else
{
if (score<60)
{
cout << "You got an F" << endl;
}

}
}
}

}
return score;
}

int _tmain(int argc, _TCHAR* argv[])

{
int total;
int score;
int i;
int average=0;
i =1;
cout << "Your score must be between 0 and 100" << endl;
total =0;
while (!(i>5))
{
cout << "what is your score?" << endl;
cin >> score;
i =i+1;
total =total+score;

}
}

double calculateAverage ( double total)
{
double average;
average =total/5;
cout << "your average is "<<average << endl;
return 0;

}

```

This post has been edited by alexandru80: 09 April 2009 - 09:07 AM

Is This A Good Question/Topic? 0

## Replies To: Test Average and Grade

### #2 janotte

• code > sword

Reputation: 991
• Posts: 5,141
• Joined: 28-September 06

## Re: Test Average and Grade

Posted 09 April 2009 - 07:17 AM

Welcome to DIC!

Cut out all the code and repost it between code tags

### #3 alexandru80

Reputation: 0
• Posts: 3
• Joined: 09-April 09

## Re: Test Average and Grade

Posted 09 April 2009 - 09:01 AM

janotte, on 9 Apr, 2009 - 06:17 AM, said:

Welcome to DIC!

Cut out all the code and repost it between code tags

thank you

### #4 janotte

• code > sword

Reputation: 991
• Posts: 5,141
• Joined: 28-September 06

## Re: Test Average and Grade

Posted 09 April 2009 - 10:30 PM

I can't see anywhere that you are calling the calculateAverage() function.

Am I looking straight through that call?

If not you will need to add:
calculateAverage(total);
to a relevant location in your main()