- #include <iostream>
- #include <string>
- using namespace std;
- int main()
- {
- int points = 0;
- string answer;
- cout << "Welcome to this game! Answer the following questions to get points.\n";
- cout << "What color is the sky?\n";
- cin >> answer;
- if (answer == "blue") {
- points += 10;
- cout << "Correct! You have earned 10 points.\n";
- }
- else {
- cout << "Incorrect. The answer is blue.\n";
- }
- cout << "What color are apples?\n";
- cin >> answer;
- if (answer == "red") {
- points += 10;
- cout << "Correct! You have earned 10 points.\n";
- }
- else {
- cout << "Incorrect. The answer is red.\n";
- }
- cout << "You have earned a total of " << points << " points.\n";
- return 0;
- }
[text] Mm.
Viewer
Editor
You can edit this paste and save as new: