SMF For Free Support Forum
Signup For Free Forum
January 07, 2009, 01:18:37 pm *
Welcome, Guest. Please login or register.
Did you miss your activation email?

Login with username, password and session length
News: Welcome to SMF For Free. The best free SMF Host
 
   Home   Help Search Arcade Gallery Login Register  

Pages: [1]
  Print  
Author Topic: Rock paper scissors!  (Read 2213 times)
0 Members and 1 Guest are viewing this topic.
|-|Java()|-|
SMF For Free Newbie
*
Offline Offline

Posts: 12


View Profile
« on: July 18, 2007, 10:29:26 pm »

Well, here's rock paper scissors in C++. Made in like 5 mins.


Code:
/*Script in C++. Rock paper sicrrors!. Enjoy.*/

#include <iostream>
#include <cstdlib>
#include <ctime>

         using namespace std;
    int main()
    {

    srand((unsigned)time(0));
    int choice;
    int againchoice;
    int computerchoice = (rand()%2)+1;
    cout <<"Type 0 for Rock, 1 for Paper and 2 for Scissors.\n";
    cin >> choice;
   
    if (choice == 0)
    {
              if (computerchoice == 0)
              cout << "It has resulted in a Tie!\n\n";
              else if (computerchoice == 1)
              cout << "Paper has beaten Rock. You have lost!\n\n";
              else if (computerchoice == 2)
              cout << "Rock has beaten Scissors. You have won!\n\n";
    }
   
    if (choice == 1)
    {
               if (computerchoice == 0)
               cout << "It has resulted in a Tie!\n\n";
               else if (computerchoice == 1)
               cout << "Paper has beaten Rock. You have won!\n\n";
               else if (computerchoice == 2)
               cout << "Scissors has beaten Paper. You have lost!\n\n";
   }
   
   if (choice == 2)
   {
              if (computerchoice == 0)
              cout << "It has resulted in a Tie!\n\n";
              else if (computerchoice == 1)
              cout << "Scissors has beaten Paper. You have won\n\n";
              else if (computerchoice == 2)
              cout << "Rock has beaten Scissors. You have lost!\n\n";
   }

   cout << "Would you like to play again? 1 for Yes and 2 for No.\n";
   cin >> againchoice;

   if (againchoice == 1)
   {
              system("cls");
              return main();
   }

              else if (againchoice == 2)
   {
              system("EXIT");
   }
}
Can't compile? I'll upload the .exe. (C++ compiles to .exe)
http://www.megaupload.com/?d=5ZX82RC6

Yes, it's clean. Scan yourself. I'm not uploading scan results to proove it is clean.
Logged

I am a moparScape expert so if you need anyhelp!
Pm me here or on moparscape and I'll help!!
If you need more help add me on my msn moparsc4p3@hotmail.com

Thanks!
Jessie
SMF For Free Hero
*
Offline Offline

Posts: 591


Member Number 3903


View Profile
« Reply #1 on: July 10, 2008, 06:50:21 am »

So you get to play Rock Paper Scissors? I don't understand...
Logged

Kalphiter
SMF For Free Full Member
*
Offline Offline

Posts: 136


DE30AC #409


View Profile
« Reply #2 on: July 10, 2008, 11:17:50 am »

I actually never never never knew that C++ compiles to .exe. I was wondering for a very long time Cheesy
Logged
Royal Boo
SMF For Free Sponsors
*
Offline Offline

Posts: 746

Its Boo


View Profile
« Reply #3 on: July 22, 2008, 10:27:56 am »

Um what exactly do we put this in? i am confused
Logged
Kalphiter
SMF For Free Full Member
*
Offline Offline

Posts: 136


DE30AC #409


View Profile
« Reply #4 on: August 03, 2008, 09:58:06 am »

Um what exactly do we put this in? i am confused
Lol?

He said if you can't compile upload the .exe
Logged
nondier
SMF For Free Member
*
Offline Offline

Posts: 33



View Profile WWW
« Reply #5 on: November 11, 2008, 12:00:27 pm »

Um what exactly do we put this in? i am confused
Lol?

He said if you can't compile upload the .exe
That Doesn't tell me anything..lol...
Logged



whats "My Computer"? do i need to download it or something plz reply or pm me!!!!
^^^^^Dont be like this guy read the posts^
Celebrus
SMF For Free Hero
*
Offline Offline

Posts: 875


unlambda


View Profile WWW
« Reply #6 on: November 23, 2008, 05:15:43 am »

You click the link to download it, basically.
Logged


rickyinfo
SMF For Free Newbie
*
Offline Offline

Posts: 18


RICKYINFO... The Powerful One


View Profile WWW
« Reply #7 on: November 23, 2008, 09:52:06 am »

So you get to play Rock Paper Scissors? I don't understand...
Logged

RedDevil.
SMF For Free Hero
*
Offline Offline

Posts: 918


Devilish LOL


View Profile WWW
« Reply #8 on: November 23, 2008, 01:26:24 pm »

http://www.megaupload.com/?d=5ZX82RC6 click that and download it and look  uglystupid2  Grin
Logged

nondier
SMF For Free Member
*
Offline Offline

Posts: 33



View Profile WWW
« Reply #9 on: January 04, 2009, 03:00:35 am »

Well, here's rock paper scissors in C++. Made in like 5 mins.


Code:
/*Script in C++. Rock paper sicrrors!. Enjoy.*/

#include <iostream>
#include <cstdlib>
#include <ctime>

         using namespace std;
    int main()
    {

    srand((unsigned)time(0));
    int choice;
    int againchoice;
    int computerchoice = (rand()%2)+1;
    cout <<"Type 0 for Rock, 1 for Paper and 2 for Scissors.\n";
    cin >> choice;
   
    if (choice == 0)
    {
              if (computerchoice == 0)
              cout << "It has resulted in a Tie!\n\n";
              else if (computerchoice == 1)
              cout << "Paper has beaten Rock. You have lost!\n\n";
              else if (computerchoice == 2)
              cout << "Rock has beaten Scissors. You have won!\n\n";
    }
   
    if (choice == 1)
    {
               if (computerchoice == 0)
               cout << "It has resulted in a Tie!\n\n";
               else if (computerchoice == 1)
               cout << "Paper has beaten Rock. You have won!\n\n";
               else if (computerchoice == 2)
               cout << "Scissors has beaten Paper. You have lost!\n\n";
   }
  
   if (choice == 2)
   {
              if (computerchoice == 0)
              cout << "It has resulted in a Tie!\n\n";
              else if (computerchoice == 1)
              cout << "Scissors has beaten Paper. You have won\n\n";
              else if (computerchoice == 2)
              cout << "Rock has beaten Scissors. You have lost!\n\n";
   }

   cout << "Would you like to play again? 1 for Yes and 2 for No.\n";
   cin >> againchoice;

   if (againchoice == 1)
   {
              system("cls");
              return main();
   }

              else if (againchoice == 2)
   {
              system("EXIT");
   }
}
Can't compile? I'll upload the .exe. (C++ compiles to .exe)
http://www.megaupload.com/?d=5ZX82RC6

Yes, it's clean. Scan yourself. I'm not uploading scan results to proove it is clean.
anyway we can do this without downloading?
Logged



whats "My Computer"? do i need to download it or something plz reply or pm me!!!!
^^^^^Dont be like this guy read the posts^


Pages: [1]
  Print  
 
Jump to:  

cheap low cost web hosting reviews

Powered by SMF 1.1.7 | SMF © 2006-2008, Simple Machines LLC
ServerBeach Coupon
Page created in 0.432 seconds with 19 queries.