Question: I've started to self learn c++ and this is an issue i had today here's the code void history() { int points; int health; points

I've started to self learn c++ and this is an issue i had today

here's the code

void history() {

int points;

int health;

points = 0;

health = 3;

do {

cout << "who was the first president of the United States of America?" << endl;

string firstusapresident;

cin >> firstusapresident;

cout << "your answer is " << firstusapresident << "and the correct answer is " << endl;

cout << "george washington " << endl;

if (firstusapresident == "george washington") {

cout << "correct answer" << endl;

points++;

} else {

cout << "wrong answer" << endl;

health--;

}

} while (health != 0);

}

whener I type in the answer i get something like this

who was the first president of the United States of America?

george washington

your answer is georgeand the correct answer is

george washington

wrong answer

how can I fix this ?

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!