[ create a new paste ] login | about

Link: http://codepad.org/gHegmLaN    [ raw code | output | fork ]

pjvangemmeren - C++, pasted on Jun 13:
//A simple five-question quiz.
#include <iostream>
#include <cstring>
#include <vector>
using namespace std;
string name = Paul;
int score;
const char t = 1;
const char f = 0;
vector <string> perfectScores;
int main()
{
    cout << "\t\tWelcome to the quiz!\n";
    cout << "1. True or false: Bats are considered rodents (t/f)?\n";
    bool firstAnswer = f;
    const bool correct = 0;
    cin >> firstAnswer;
    if (firstAnswer == correct)
    {
        cout << "Correct!\n";
        score = 20;
    }
    else
    {
        cout << "Incorrect\n";
        score = 0;
    }
    cout << "2. True or false: Orcas are considered whales (t/f)?\n";
    bool secondAnswer = f;
    const bool correct2 = 0;
    cin >> secondAnswer;
    if (secondAnswer == correct2)
    {
        cout << "Correct!\n";
        score = (score + 20);
    }
    else
    {
        cout << "Incorrect\n";
    }
    cout << "3. True or false: Carbon's atomic number is 8 (t/f)?\n";
    bool thirdAnswer = f;
    const bool correct3 = 0;
    cin >> thirdAnswer;
    if (thirdAnswer == correct3)
    {
        cout << "Correct!\n";
        score = (score + 20);
    }
    else
    {
        cout << "Incorrect\n";
    }
    cout << "4. True or false: Hippopotamonstrosisquipsaliophobia is the fear of immensely long words (t/f)?\n";
    bool fourthAnswer = t;
    const bool correct4 = 1;
    cin >> fourthAnswer;
    if (fourthAnswer == correct4)
    {
        cout << "Correct!\n";
        score = (score + 20);
    }
    else
    {
        cout << "Incorrect\n";
    }
    cout << "Last question for double or nothing:\n";
    cout << "True or false: The word \'screeched\' is the longest monosyllabic word in the English language (t/f)?\n";
    bool finalAnswer = t;
    const bool correct5 = 1;
    cin >> finalAnswer;
    if (finalAnswer == correct5)
    {
        cout << "CORRECT!\n";
        score = (score + score);
    }
    else
    {
        cout << "You lost it all.";
    }
    cout << "\n\n\t\tYour final score is:\n\n\t\t\t" << score << "\n";
    cout << "\n1.Play again\n2.View perfect scores\n3.Quit\nEnter the number of your choice:\n";
    int choice;
    const int play = 1;
    const int view = 2;
    const int exit = 3;
    cin >> choice = view;
    if (choice == play)
    {
    return 1;
    }
    else if (choice == view)
    {
        cout << perfectScores<< "\n1. Play again\n3. Quit\n";
        cin >> choice;
    return 94;
    }
    else if (choice == 3)
    {
        cout << endl;
        cout << "\n\n\t\tGoodbye!\a";
    return 0;
    }
    if (score == 160)
    {
        if (score == 160)
        {
            cout << "Enter your name and press enter.\n";
            cin >> name;
            perfectScores.push_back(name);
            cout << "\n\t\tCongratulations!\n";
            cout << "\n1.Play again\n2.View perfect scores\n3.Quit\nEnter the number of your choice:\n";
            int choice;
            const int play = 1;
            const int view = 2;
            const int exit = 3;
            cin >> choice;
        if (choice == play)
        {
        return 1;
        }
        else if (choice == view)
        {
            cout << perfectScores<< "\n1. Play again\n3. Quit\n";
            cin >> choice;
    return 94;
    }
    else if (choice == 3)
    {
        cout << endl;
        cout << "\n\n\t\tGoodbye!\a";
    return 0;
    }

        }
    return 0;
    }
}


Output:
1
2
Line 6: error: 'Paul' was not declared in this scope
compilation terminated due to -Wfatal-errors.


Create a new paste based on this one


Comments: