#include <iostream.h> #include <string> #include <conio.h> using namespace std; int main(void) { int count = 0; double total = 0.0; double i = 0.0; int infractions = -1; // constant integer for number of classes int numOfClasses = 0; string name; cout << "How many classes are you taking?:" << endl; cin >> numOfClasses; cout << "Please enter your grades (" << numOfClasses << "):" << endl; while(count < numOfClasses) { // stores input to temporary i double cin >> i; // this means total = total + i; total += i; cout << endl; count++; } cout << "Enter your full name: "; cin >> name; cout << endl; cout << "How many discipline infractions do you have?: "; cin >> infractions; cout << endl; cout << "Your total points are " << total; cout << endl; double average = total/numOfClasses; cout << "Your average..." << average << endl; // if(infractions == 0) { if(average >= 90.0) { if(numOfClasses >= 5) { cout << " You are eligible because you have " << infractions << " infractions, " << average << " average, and are taking more than 5 classes. " << endl; cout << " Congratulations! Good luck this year! " << endl; } else { cout << " You are ineligible because you do not have 5 or more classes." << endl; cout << "I'm sorry just try again next time." << endl; } } else { cout << "You are ineligible because you do not have a 90.0+ average." << endl; cout << "Only if you did better." << endl; } } else { cout << "You are ineligible." << endl; cout << "I'm sorry, better luck next time." << endl; } getch(); return 0; } |
cin >> name;
which by definition reads only one word. You need to use getline() to read the entire line.