0

HELP Why wont this work?

// Test.cpp : Defines the entry point for the console application.
//

#include <iostream>
using namespace std;
#include "Apstring.h"
#include "apstring.cpp"

int main()
{
    apstring Game;
    apstring rndnum;
    apstring rdy;
    system("color a");
    system("Echo GREETINGS PROFESSOR FALKIN");
    cout << endl;
    cout << "WOULD YOU LIKE TO PLAY A GAME?   ";
    cin >> Game;
    if ( Game == "Yes" || "yes") {
        cout << "HOW ABOUT A NICE GAME OF random numbers?   " ;
        cin >> rndnum;
        if ( rndnum == "Yes" || "yes") {
            system("CLS");
            int num = rand();
            int Guess;
            cout << "READY?";
            cin >> rdy;
            if (rdy == "Yes" || "yes") {
                cout << "GUESS A NUMBER BETWEEN 1 --- 25.   ";
                cin >> Guess;
                if ( Guess == num ) {
                    system("ECHO    YOU WIN! ");
                    system("COLOR B");
                    system("COLOR B");
                    system("COLOR B");
                    system("COLOR B");
                    system("COLOR B");
                    system("COLOR B");
                    system("COLOR B");
                    system("COLOR B");
                    system("COLOR B");
                    system("COLOR B");
                    system("COLOR B");
                    system("COLOR C");
                    system("COLOR C");
                    system("COLOR C");
                    system("COLOR C");
                    system("COLOR C");
                    system("COLOR C");
                    system("COLOR C");
                    system("COLOR C");
                    system("COLOR C");
                    system("COLOR C");
                    system("COLOR A");
                }else {
                    system("ECHO NOPE")
                }
                }else {
                    system("ECHO BYE!")
            }
            }else {
                system("Echo BYE!")
                }
        }else {
            system("echo BYE!")
                    }
    }else {
        system("echo BYE!")
                }
    system("pause");
    return 0;
}
4
Contributors
4
Replies
13
Views
3 Years
Discussion Span
Last Post by tinstaafl
0

lines 19 and 22 are wrong. How about other versions of yes, such as yEs and yeS and yES? It would be a lot easier to just convert rndnum to all upper or lower case characters then check for that.

if ( rndnum == "Yes" || rmdnum == "yes")

0

some of your System statements aren't terminated in a semicolon and you have 1 too many else blocks which puts it and the last 2 statements outside of the main block

Edited by tinstaafl

0

I use Visual Studio. It has high end syntax checking and debugging. Once you get used to that, it's hard to switch.

Edited by tinstaafl

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.