Advertise Here

Author Topic: Rock paper scissors!  (Read 22184 times)

0 Members and 1 Guest are viewing this topic.

Offline |-|Java()|-|

  • SMF For Free Newbie
  • *
  • Posts: 12
    • View Profile

  • Total Badges: 11
    Badges: (View All)
    Topic Starter Combination Level 2 Level 1 10 Posts
Rock paper scissors!
« on: July 18, 2007, 10:29:26 pm »
Well, here's rock paper scissors in C++. Made in like 5 mins.


Code: [Select]
/*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.
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!

Offline Jessie

  • SMF For Free Hero
  • *
  • Posts: 754
    • View Profile
    • iSimple

  • Total Badges: 18
    Badges: (View All)
    Windows User Apple User Mobile User Topic Starter Combination
Re: Rock paper scissors!
« Reply #1 on: July 10, 2008, 06:50:21 am »
So you get to play Rock Paper Scissors? I don't understand...
Feel free to PM me or email me. ;)

My Forum :)

Offline Kalphiter

  • SMF For Free Full Member
  • *
  • Posts: 135
  • DE30AC #409
    • View Profile

  • Total Badges: 14
    Badges: (View All)
    Topic Starter Combination Level 3 Level 2 Level 1
Re: Rock paper scissors!
« 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 :D

Offline Suki The Saluki

  • SMF For Free Sponsors
  • *
  • Posts: 827
    • View Profile

  • Total Badges: 14
    Badges: (View All)
    Topic Starter Combination Level 3 Level 2 Level 1
Re: Rock paper scissors!
« Reply #3 on: July 22, 2008, 10:27:56 am »
Um what exactly do we put this in? i am confused

Offline Kalphiter

  • SMF For Free Full Member
  • *
  • Posts: 135
  • DE30AC #409
    • View Profile

  • Total Badges: 14
    Badges: (View All)
    Topic Starter Combination Level 3 Level 2 Level 1
Re: Rock paper scissors!
« 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

Offline nondier

  • SMF For Free Member
  • *
  • Posts: 38
    • View Profile
    • Synysterscape

  • Total Badges: 12
    Badges: (View All)
    Windows User Topic Starter Combination Level 2 Level 1
Re: Rock paper scissors!
« 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...
<embed src="http://www.xatech.com/web_gear/chat/chat.swf" quality="high" bgcolor="#000000" width="540" height="405" name="chat" FlashVars="id=40672730&gn=Synysterscape" align="middle" allowScriptAccess="sameDomain" type="application/x-shockwave-flash" pluginspage="http://xat.com/update_flash.s

Offline Celebrus

  • SMF For Free Hero
  • *
  • Posts: 941
    • View Profile
    • Vikhyat Korrapati

  • Total Badges: 16
    Badges: (View All)
    Topic Starter Combination Level 3 Level 2 Level 1
Re: Rock paper scissors!
« Reply #6 on: November 23, 2008, 05:15:43 am »
You click the link to download it, basically.

Offline rickyinfo

  • SMF For Free Newbie
  • *
  • Posts: 18
  • RICKYINFO... The Powerful One
    • View Profile
    • RI Club Forum

  • Total Badges: 11
    Badges: (View All)
    Topic Starter Combination Level 2 Level 1 10 Posts
Re: Rock paper scissors!
« Reply #7 on: November 23, 2008, 09:52:06 am »
So you get to play Rock Paper Scissors? I don't understand...

Offline [JeReMy]

  • SMF For Free Master
  • *
  • Posts: 1174
  • www.ourhangout.org
    • View Profile
    • ourhangout

  • Total Badges: 16
    Badges: (View All)
    Topic Starter Combination Level 3 Level 2 Level 1
Re: Rock paper scissors!
« Reply #8 on: November 23, 2008, 01:26:24 pm »
http://www.megaupload.com/?d=5ZX82RC6 click that and download it and look  :uglystupid2:  ;D

Offline nondier

  • SMF For Free Member
  • *
  • Posts: 38
    • View Profile
    • Synysterscape

  • Total Badges: 12
    Badges: (View All)
    Windows User Topic Starter Combination Level 2 Level 1
Re: Rock paper scissors!
« Reply #9 on: January 04, 2009, 03:00:35 am »
Well, here's rock paper scissors in C++. Made in like 5 mins.


Code: [Select]
/*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?
<embed src="http://www.xatech.com/web_gear/chat/chat.swf" quality="high" bgcolor="#000000" width="540" height="405" name="chat" FlashVars="id=40672730&gn=Synysterscape" align="middle" allowScriptAccess="sameDomain" type="application/x-shockwave-flash" pluginspage="http://xat.com/update_flash.s

Offline raggi5

  • SMF For Free Member
  • *
  • Posts: 20
    • View Profile

  • Total Badges: 12
    Badges: (View All)
    Search Windows User Topic Starter Combination Level 2
Re: Rock paper scissors!
« Reply #10 on: May 31, 2009, 01:50:07 am »
you can compile by copy>paste to notepad, then save as blank.exe and run it :)

Offline Celebrus

  • SMF For Free Hero
  • *
  • Posts: 941
    • View Profile
    • Vikhyat Korrapati

  • Total Badges: 16
    Badges: (View All)
    Topic Starter Combination Level 3 Level 2 Level 1
Re: Rock paper scissors!
« Reply #11 on: May 31, 2009, 06:23:22 am »
you can compile by copy>paste to notepad, then save as blank.exe and run it :)

Was that sarcasm?

If not, did you actually try doing that? Did it work?

In reality, you'd need a compiler. mingw is a really nice one.

Offline raggi5

  • SMF For Free Member
  • *
  • Posts: 20
    • View Profile

  • Total Badges: 12
    Badges: (View All)
    Search Windows User Topic Starter Combination Level 2
Re: Rock paper scissors!
« Reply #12 on: June 06, 2009, 03:22:46 pm »
you can compile by copy>paste to notepad, then save as blank.exe and run it :)

Was that sarcasm?

If not, did you actually try doing that? Did it work?

In reality, you'd need a compiler. mingw is a really nice one.

actually no, it worked for me :)

 

Related Topics

  Subject / Started by Replies Last post
0 Replies
930 Views
Last post October 13, 2007, 06:57:21 pm
by gaaras sensei
0 Replies
895 Views
Last post November 11, 2007, 08:37:33 pm
by LastnLine
0 Replies
875 Views
Last post October 17, 2008, 04:56:57 pm
by Dr Feelgood
16 Replies
10951 Views
Last post January 18, 2009, 10:38:20 am
by Didds
6 Replies
1565 Views
Last post February 05, 2010, 10:05:08 pm
by Babymama