Jump to content

Helooo

- - - - -

  • Please log in to reply
6 replies to this topic

#1
TheCompBoy

TheCompBoy

    Programming Professional

  • Members
  • PipPipPipPipPip
  • 272 posts
Hello! i'm a 14 year young boy that started programming like 2-3 weeks ago.. before i started programming i did alot of scripting and small programming for android (wanted to make my own apps) and then i watched the movie "The Social Network" its about the making of facebook.. and that was what triggered me.. Now i spend like all time i got programming playing around in the compiler trying out and experimenting with the C++ language which is the one i learn... Bought some books.. one for game programing and one for just learning the language but the one that learns me C++ overall sucks soo.. if anyone know a good book that will get me started welcome to post here too... Maybe i also can post the code to my text game i made when i played around with the "cout" and the "if statement".. Well thats about much about me.. and little of my programming history.. (lol)

TheCompBoy.

#include <cstdlib>

#include <iostream>


using namespace std;

//The first startdoor that you can pick in the game

int normaldoor()

{

    //Command that clears the console from text

    system("CLS");

    //some info about where you are.

    cout << "You entered the room and you found a large room \n";

    //the search char that will decide if you whana search or not

    char search;

    cout << "Do you whant to search the room? (y/n)";

    cin >> search;

    //If statement that tells you what happend if you search or not.

    if (search == 'n')

        cout << "Seems like you are not intrested in looking around \n you just walk to the next room.. \n";

    else if (search == 'y')

        {

            cout << "You look around but find nothing but a bookshelf with some booring books \n";

            cout << "You walk to the next room.. \n";

        }

    //Here is the char that will let you continue and clear the screen from text    

    char cont;

    cin >> cont;

    // Here the the command that clears the screen

    system("CLS");

    // Text that tells you that the dragon kills you..

    cout << "In this room you find a big fire dragon.. \n";

    cout << "He spits a big fireball at you and you die. n";

    cout << "GAME OVER YOU DIED \n";

    // char that make the program nu auto shutdown..

    char end;

    cin >> end;    

    return 0;

}

//The second startdoor you can pick in the game

int metaldoor()

{

    //The command that clears the console

    system("CLS");

    // The info about the room you just entered

    cout << "You entered the room and found some kind of old prison \n";

    cout << "You look around and finds some skeleton's..\n";

    // the scared char that will decide if you get scared of the skeleton's or not

    char scared;

    // do you get scared question

    cout << "Do you get scared? (y/n)";

    cin >> scared;

    //The if statement that decide what happend if you get scared or not.

    if (scared == 'n')

        cout << "You don't get scared of that.. its not scary.. \n";

    else if (scared == 'y')

    {

        cout << "You get scared and **** your pants.. \n";

        cout << "But you don't find a way to clean yourself so \n";

        cout << "you just try to ignore it \n";    

    }

    //The beginning of the next room..

    cout << "You walk to the next room.. \n";

    cout << "Type some something to continue. \n";

    //The continue that will clear the console and let you know what happends next

    char cont;

    cin >> cont;

    // Command that clears the screen from text

    system("CLS");

    // Text that tells you that you won..

    cout << "You found a way out of the castle.. \n";

    cout << "YOU WIN! \n";

    

    //char that makes the program not to auto shutdown.

    char end;

    cin >> end;

    return 0;

}

//The 3rd startdoor you can pick in the game

int opendoor()

{

    system("CLS");

    cout << "You entered the room and you see some one sleeping in the couch..\n";

    cout << "Do you whant to wake the person up and see whats going on? (y/n) \n";

    //the char wake will decide if you shall wake the person up or not

    char wake;

    cin >> wake;

    //The if statement that will decide your fate after deciding wake the mand or not

    if (wake == 'n')

       {

             //what happends if you not wake the man

        cout << "You don't whant to wake the person up you continue look around \n";

        cout << "You find a big chest that seems to be unlocked.. \n";

        cout << "You walk to the chest and start opening it... \n";

        cout << "You look inside the chest and found a small peace of gold \n";

        cout << "But now you hear a voice from behind..\n";

        cout << "Hey! what the heck are you doin?? \n";

        cout << "You turn around and see he holds a knife in his hand. \n";

        cout << "You are unlucky the man that woke up stabs you in the belly \n";

        cout << "Before you are able to take action.. \n";

        cout << "GAME OVER YOU DIED! \n";

        char end;

        cin >> end;   

       }

     else if (wake == 'y')

       {

             // what happends if you wake the man.

        cout << "You step to the man and taps him on the shoulder.. \n";

        cout << "Sir please wake up! \n";

        cout << "The man gets so scared he picks up a knife and stab you \n";

        cout << "You had no chance to take action.. \n";

        cout << "GAME OVER YOU DIED! \n";

        char end;

        cin >> end;

       }   

    return 0;

}

//Main function here the base of the game.

int main(int argc, char *argv[])

{

    //The welcome screen / text

    cout << "Welcome to castle adventures \n";

    cout << "This small text-based game will take you through a castle..\n";

    cout << "If you pick the wrong path something wrong will happend\n";

    cout << "Type some random text to begin. if you type anything else than \n";

    cout << "text the program will get error and shut down.. \n";

    //char that makes the player have time to watch the text before it disapears

    char begin;

    cin >> begin;

    //Command to clear the console from text

    system("CLS");

    //Beggining of the game

    cout << "You just entered a castle that is very big.. you whant to explore it a bit..\n";

    cout << "There is three doors infront of you..\n";

    cout << "1. Just a normal wodden door. \n";

    cout << "2. Spooky metal door. \n";

    cout << "3. Small door that is little bit open and you can see a light from the\nroom behind it\n";

    cout << "Choose door by typing 1-3\n";

    //the int that will hold the door number.

    int startdoor;

    cin >> startdoor;

    //The if that will make stuff happend depending which door you take.

    //Also this if will take the game too a new function depending on what path you take.

    if (startdoor == 1)

        normaldoor();

    else if (startdoor == 2)

        metaldoor();

    else if (startdoor == 3)

        opendoor();

 

                

    

    

    

}


#2
WingedPanther

WingedPanther

    A spammer's worst nightmare

  • Moderators
  • 16,831 posts
  • Location:Upstate, South Carolina
  • Programming Language:C, C++, PL/SQL, Delphi/Object Pascal, Pascal, Transact-SQL, Others
  • Learning:Java, C#, PHP, JavaScript, Lisp, Fortran, Haskell, Others
Welcome aboard!
Programming is a branch of mathematics.
My CodeCall Blog | My Personal Blog

#3
Alexander

Alexander

    It's Science!

  • Moderators
  • 4,118 posts
  • Location:Vancouver, Eh! Cleverness: 200
Welcome! I actually started out with those types of programs that you wrote in Visual Basic 5 or something at least a decade ago, they are entertaining way to learn.

As for books, actually a great way to get a breadth of opinions about them is to search online for "Best C++ book for beginners", I know at least one or two stackoverflow.com provides a thread or two of some great opinions. One good one if I recall is free online as HTML chapters, of course we have a lot of tutorials too in our tutorials section for more advanced things if you want to break down those applications and learn from them!
Be sure to read the updated FAQ! || Health is achieved through the same 10,000 steps.
If a suggested code/method fails, informing us is less important than telling us why or what errors occurred.

#4
CommittedC0der

CommittedC0der

    Speaks fluent binary

  • Members
  • PipPipPipPipPipPipPipPip
  • 1,565 posts
Welcome to CodeCall, you should also check out O'Reilly Media, there known to have some pretty good books. :)
~ Committed.
A man can be defined by what he does when no one is looking.
Science is only an educated theory, which we cannot disprove.

#5
TheCompBoy

TheCompBoy

    Programming Professional

  • Members
  • PipPipPipPipPip
  • 272 posts
Thanks for the warm welcome..

#6
LuthfiHakim

LuthfiHakim

    Programming God

  • Members
  • PipPipPipPipPipPipPip
  • 763 posts
Welcome aboard! It's always refreshing to see such a spirit!

#7
TheCompBoy

TheCompBoy

    Programming Professional

  • Members
  • PipPipPipPipPip
  • 272 posts
Haha, Am just like when i am learning something new in programming i whant to realy try use it to the max in some program so i realy remember it and learn it perfectly :P




1 user(s) are reading this topic

0 members, 1 guests, 0 anonymous users