error in TLOL

This is a discussion on error in TLOL within the C++ Programming forums, part of the General Programming Boards category; what is wrong with this code? #include <iostream> #include <stdlib.h> using namespace std; // Help funciton. void Help() { cout<<endl<<endl<<"TLOL ...

  1. #1
    Registered User
    Join Date
    Jul 2003
    Posts
    27

    Question error in TLOL

    what is wrong with this code?


    #include <iostream>
    #include <stdlib.h>
    using namespace std;

    // Help funciton.
    void Help()
    {
    cout<<endl<<endl<<"TLOL is a very simple game. You will be prompted with text and you simply";
    cout<<endl<<"choose a selection from inside the parenthesise. Now here is once again the";
    cout<<endl<<"main menu."
    return 0;
    }

    // Help funciton.
    void Play()
    {

    return 0;
    }

    // main function
    int main(int argc, char *argv[])
    {
    cout<<" -=([ The Land Of Lista ])=- "<<endl;
    cout<<<<endl<<" * |>>> +"<<endl;
    cout<<"+ * | * +"<<endl;
    cout<<" |>>> _ _|_ _ * |>>>"<<endl;
    cout<<" * | |;| |;| |;| | *"<<endl;
    cout<<" + _ _|_ _ \\. . / _ _|_ _ +"<<endl;
    cout<<" * |;|_|;|_|;| \\: + / |;|_|;|_|;|"<<endl;
    cout<<" \\.. / ||:+++. | \\. . / *"<<endl;
    cout<<" + \\. , / ||:+++ | \\: . /"<<endl;
    cout<<" ||:+ |_ _ ||_ . _ | _ _||:+ | *"<<endl;
    cout<<" * ||+++.|||_|;|_|;|_|;|_|;|_|;||+++ | +"<<endl;
    cout<<" ||+++ ||. . . . ||+++.| *"<<endl;
    cout<<"+ * ||: . ||:. . . . , ||: | *"<<endl;
    cout<<" * ||: ||: , + . ||: , | +"<<endl;
    cout<<" * ||: ||:. +++++ . ||: | *"<<endl;
    cout<<" + ||: ||. +++++++ . ||: . | +"<<endl;
    cout<<" + ||: . ||: , +++++++ . . ||: | +"<<endl;
    cout<<" ||: . ||: , +++++++ . . ||: | *"<<endl;
    cout<<" ||: . ||: , +++++++ . . ||: |"<<endl<<endl;
    cout<<"Welcome to The Land Of Lista! TLOL is a puzzle/adventure game."<<endl;
    cout<<"It is single player. Please make your selection on this menu."<<endl<<endl;
    cout<<"1. Play Game"<<endl;
    cout<<"2. Help Me"<<endl;
    cout<<"3. Quit Game"<<endl<<endl;
    cout<<"Choice ( 1,2,3 ): ";
    cin<<int input;
    switch input
    {
    case 1: Play(); break;
    case 2: Help(); break;
    case 3: break;
    }
    return 0;
    }


    I just cant get it... I am not good with switch or functions however...

  2. #2
    Registered User
    Join Date
    Oct 2002
    Posts
    291
    Use code tags

    Code:
    #include <iostream>
    #include <stdlib.h>
    using namespace std;
    
    // Help funciton.
    void Help()
    {
      cout<<endl<<endl<<"TLOL is a very simple game. You will be prompted with text and you simply";
      cout<<endl<<"choose a selection from inside the parenthesise. Now here is once again the";
      cout<<endl<<"main menu.";
      //return 0; 
    }
    
    // Help funciton.
    void Play()
    {
      //return 0; 
    }
    
    // main function
    int main(int argc, char *argv[])
    {
      cout<<" -=([ The Land Of Lista ])=- "<<endl;
      cout<<endl<<" * |>>> +"<<endl;
      cout<<"+ * | * +"<<endl;
      cout<<" |>>> _ _|_ _ * |>>>"<<endl;
      cout<<" * | |;| |;| |;| | *"<<endl;
      cout<<" + _ _|_ _ \\. . / _ _|_ _ +"<<endl;
      cout<<" * |;|_|;|_|;| \\: + / |;|_|;|_|;|"<<endl;
      cout<<" \\.. / ||:+++. | \\. . / *"<<endl;
      cout<<" + \\. , / ||:+++ | \\: . /"<<endl;
      cout<<" ||:+ |_ _ ||_ . _ | _ _||:+ | *"<<endl;
      cout<<" * ||+++.|||_|;|_|;|_|;|_|;|_|;||+++ | +"<<endl;
      cout<<" ||+++ ||. . . . ||+++.| *"<<endl;
      cout<<"+ * ||: . ||:. . . . , ||: | *"<<endl;
      cout<<" * ||: ||: , + . ||: , | +"<<endl;
      cout<<" * ||: ||:. +++++ . ||: | *"<<endl;
      cout<<" + ||: ||. +++++++ . ||: . | +"<<endl;
      cout<<" + ||: . ||: , +++++++ . . ||: | +"<<endl;
      cout<<" ||: . ||: , +++++++ . . ||: | *"<<endl;
      cout<<" ||: . ||: , +++++++ . . ||: |"<<endl<<endl;
      cout<<"Welcome to The Land Of Lista! TLOL is a puzzle/adventure game."<<endl;
      cout<<"It is single player. Please make your selection on this menu."<<endl<<endl;
      cout<<"1. Play Game"<<endl;
      cout<<"2. Help Me"<<endl;
      cout<<"3. Quit Game"<<endl<<endl;
      cout<<"Choice ( 1,2,3 ): ";
      int input;
      cin>>input;
      switch (input)
      {
        case 1: Play(); break;
        case 2: Help(); break;
        case 3: break;
      } 
      return 0;
    }

Popular pages Recent additions subscribe to a feed

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21