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;
}

Recommended Answers

All 4 Replies

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")

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

I assume your compiler gives you some helpful error messages.

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

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.