int A = 90, a = 90;
int B = 80, b = 80;
int C = 70, c = 70;
int D = 60, d = 60;
int F = 0, f = 0;
cout << " Please enter the number of grades to average:\n";
cin >> numgrade;
while (count < numgrade)
{
cout << " Please enter grade in letter format:\n";
cin >> usergrade;
cout << " You entered " << usergrade << ".\n";
totalgrades = usergrade + totalgrades;
C++ doesn't work like that (actually, I don't know of any language that does). You would first need to handle the input, then, depending on what character the user entered, you would add that value to total grades. This is a tricky process and I believe you'd be better off entering the grades as a number (that's not to say that's it's impossible, however).
I believe in the "totalgrades = usergrade + totalgrades" is adding a character to an intergral. Take a look at that and I think you might know how to take it from there.
As easygoing has said the totalgrades = usergrade + totalgrades declaration is wrong. When you add a char to an int it takes the character's integers value and adds that to the int. Take a look at an ASCII chart that should help you understand what is wrong.
If you want to continue using the char input you should use either a switch statement or a ton of if else statements.
for example
switch(usergrade) {
case 'A':
totalgrades += 90;
break;
}
for(int cnt = 0; cnt < numOf; cnt++)
{
cout<<"Please enter your grade: ";
cin>> grade;
if(toupper(grade)== 'A')
total = total + 90;
elseif (toupper(grade)=='B')
total = total + 80;
elseif(toupper(grade)=='C')
total = total + 70;
elseif(toupper(grade) =='D')
total = total + 60;
elseif(toupper(grade)=='F')
total = total + 50;
else {}
}
average = total / numOf;
This is what I fixed. I'm still getting errors. It seems to only repeat the sequence once.
//
// main.cpp
// School Book averaging Test
//
// Created by Hoekwater_Nicholas on 12/18/12.
// Copyright (c) 2012 Combatoid. All rights reserved.
//
#include <iostream>
using namespace std;
int main()
{
char usergrade;
int totalgrades = 0;
double numgrade;
double count;
int average = 0;
int A = 90, a = 90;
int B = 80, b = 80;
int C = 70, c = 70;
int D = 60, d = 60;
int F = 0, f = 0;
cout << " Please enter the number of grades to average:\n";
cin >> numgrade;
while (count <= numgrade)
{
count = count + 1;
cout << " Please enter the percentage scored on each assignment(without %):\n";
cin >> usergrade;
break;
if(usergrade >= 90)
{
cout << "This assignment scored an A.";}
else if(usergrade>= 80)
{