Nevermind...here's what I got:
Code:
#include <iostream>
using namespace std;
int main () {
int countA = 0;
int countB = 0;
int countC = 0;
int countD = 0;
int countF = 0;
double score = 0.0;
int numberOfAs = 0;
int numberOfBs = 0;
int numberOfCs = 0;
int numberOfDs = 0;
int numberOfFs = 0;
cout << "Number of A's: " << numberOfAs <<endl;
cout << "Number of B's: " << numberOfBs <<endl;
cout << "Number of C's: " << numberOfCs <<endl;
cout << "Number of D's: " << numberOfDs <<endl;
cout << "Number of F's: " << numberOfFs <<endl;
cout << "Enter a score (%) or -1 to end: ";
cin >> score;
if (score != -1) {
while (score != -1) {
if (score >= 90) {
numberOfAs++;
}
if (score >= 80 && score < 90) {
numberOfBs++;
}
if (score >= 70 && score < 80) {
numberOfCs++;
}
if (score >= 60 && score < 70) {
numberOfDs++;
}
if (score >= 0 && score < 60) {
numberOfFs++;
}
cout << "Number of A's: " << numberOfAs <<endl;
cout << "Number of B's: " << numberOfBs <<endl;
cout << "Number of C's: " << numberOfCs <<endl;
cout << "Number of D's: " << numberOfDs <<endl;
cout << "Number of F's: " << numberOfFs <<endl;
cout << "Enter a score (%) or -1 to end: ";
cin >> score;
}
}
cout << endl;
cout << "A's: ";
while (countA < numberOfAs) {
cout << "*";
countA++;
}
cout << endl;
cout << "B's: ";
while (countB < numberOfBs) {
cout << "*";
countB++;
}
cout << endl;
cout << "C's: ";
while (countC < numberOfCs) {
cout << "*";
countC++;
}
cout << endl;
cout << "D's: ";
while (countD < numberOfDs) {
cout << "*";
countD++;
}
cout << endl;
cout << "F's: ";
while (countF < numberOfFs) {
cout << "*";
countF++;
}
cout << endl;
return 0;
} Any suggestions on simplifying it? I'm not familiar enough with functions yet to be comfortable with them, but if anyone has suggestions, that would be appreciated!
Maat