mardi 18 juillet 2017

assigning the user's cin value

I am new to c++, and have been stuck on this problem for about 2 days.

I am trying to make it so that when the user inputs either 'North' or 'South', the corresponding phrase and question will appear.

I am using a if/else statement, and this has worked multiple times when using a int value, but now that I am no longer using a numerical value, the compiler has been not allowing it to run. I have been watching every video possible to try and figure out what is wrong, but can't find the mistake.

the mistake is in the parenthesis when I use the term 'South'. It says "invalid operands to binary expression", "character constant too long for its type", and "Multi character character constant".

As I said before, I am new to this so if my terms are incorrect I apologize, but any help is appreciated.

The mistake is on the line with If beginning it.

include

include

using namespace std;

int main() {

string schoolRegion;
getline(cin, schoolRegion);

//introduction to questionaire cout << "If you want to play division 1 Lacrosse, take the following questionaire to determine which schools would be a great fit for you!\n\n";

cout << "Enter below if you want to attend a school in the North or South." << endl;
cin >> schoolRegion;

if(schoolRegion=='South') {
    cout << "The South has 1 main conference known as the SOCON.\n";
    cout << "In the SOCON their are 8 schools./n";
    cout << "1) Air Force\n 2) Bellarmine\n 3) Furman\n 4) High Point\n 5) Jacksonville\n 6) Mercer\n 7) Richmond\n 8) VMI\n";
}else{
    cout << "The North has over 60 D1 schools, which will allow for many options.\n";
}






return 0;

}

Aucun commentaire:

Enregistrer un commentaire