Advertisement
Techmo

c++rpsprank

Dec 23rd, 2013
197
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 7.13 KB | None | 0 0
  1. #include <iostream>
  2. #include <stdlib.h>
  3. #include <windows.h>
  4. #include <conio.h>
  5. using namespace std;
  6.  
  7. void v1(void)
  8. {
  9.     cout<< "                         +----------------------------+" << endl;
  10. }
  11. int main()
  12. {
  13.     int score = 0;
  14.     int l = 0;
  15.     int turns = 0;
  16.     int wantedturns = 10;
  17.     int r = 1;
  18.     string color;
  19.     cout<<  "You're about to play 'Rock Paper Scissors' for your data" << endl;
  20.     cout<< "--------------------------------------------------------" << endl;
  21.     cout<< "You need to win at least ";
  22.     cout<< "5";
  23.     cout<< " rounds to save your data" << endl;
  24.     cout<< "--------------------------------------------------------" << endl;
  25.     cout<< "Dont be sad, At least you get to pick a color:" << endl;
  26.     cout<< "Syntax: bgcolor next to textcolor 'no space'" << endl;
  27.     cout<< "example: 0a is black background with light green text" << endl;
  28.     cout<< "Colors:" << endl;
  29.     cout<< "0 = Black" << endl;
  30.     cout<< "1 = Blue" << endl;
  31.     cout<< "2 = Green" << endl;
  32.     cout<< "3 = Aqua" << endl;
  33.     cout<< "4 = Red" << endl;
  34.     cout<< "5 = Purple" << endl;
  35.     cout<< "6 = Yellow" << endl;
  36.     cout<< "7 = White" << endl;
  37.     cout<< "8 = Gray" << endl;
  38.     cout<< "9 = Light Blue" << endl;
  39.     cout<< "a = Light Green" << endl;
  40.     cout<< "b = Light Auqua" << endl;
  41.     cout<< "c = Light Red" << endl;
  42.     cout<< "d = Light Purple" << endl;
  43.     cout<< "e = Light Yellow" << endl;
  44.     cout<< "f = Bright White" << endl;
  45.     cout<< "Color: ";
  46.     cin>> color;
  47.     string c2 = "color ";
  48.     c2 += color;
  49.     system(c2.c_str());
  50.     system("cls");
  51.     while (turns != wantedturns)
  52.     {
  53.     turns++;
  54.     string wep;
  55.     string ch;
  56.     cout<< "---------+-----------------------------------+" << endl;
  57.     cout<< "Round: ";
  58.     cout<< r << " |" << " Current score: You-" << score << " | Computer-" << l << " |" << endl;
  59.     cout<< "---------+-----------------------------------+" << endl;
  60.     cout<< endl << "Enter your choice: 'Rock', 'Paper', 'Scissors':";
  61.     cin>> wep;
  62.     system("cls");
  63.     string rock = "rock";
  64.     string paper = "paper";
  65.     string scissors = "scissors";
  66.     int random = rand() % 3 + 1;
  67.     if (random == 1)
  68.     {
  69.         ch = "rock";
  70.     }
  71.     if (random == 2)
  72.     {
  73.         ch = "paper";
  74.     }
  75.     if (random == 3)
  76.     {
  77.         ch = "scissors";
  78.     }
  79.     if (wep != ch && wep == paper && ch == scissors)
  80.     {
  81.         l++;
  82.         cout<<"Computer wins | You: '" << wep << "'" << " | Computer: '" << ch <<"'";
  83.     }
  84.     if (wep != ch && wep == rock && ch == paper)
  85.     {
  86.         l++;
  87.         cout<<"Computer wins | You: '" << wep << "'" << " | Computer: '" << ch <<"'";
  88.     }
  89.     if (wep != ch && wep == scissors && ch == rock)
  90.     {
  91.         l++;
  92.         cout<<"Computer wins | You: '" << wep << "'" << " | Computer: '" << ch <<"'";
  93.     }
  94.     if (wep != ch && wep == paper && ch == rock)
  95.     {
  96.         cout<<"You win | You: '" << wep << "'" << " | Computer: '" << ch <<"' |";
  97.         score++;
  98.     }
  99.     if (wep != ch && wep == rock && ch == scissors)
  100.     {
  101.         cout<<"You win | You: '" << wep << "'" << " | Computer: '" << ch <<"'";
  102.         score++;
  103.     }
  104.     if (wep != ch && wep == scissors && ch == paper)
  105.     {
  106.         cout<<"You win | You: '" << wep << "'" << " | Computer: '" << ch <<"'";
  107.         score++;
  108.     }
  109.     if (wep == ch)
  110.     {
  111.         cout<<"It's a tie | You: '" << wep << "'" << "| Computer: '" << ch <<"'";
  112.     }
  113.     r++;
  114.     Sleep(3000);
  115.     system("cls");
  116.     }
  117.     int fscore = wantedturns / 2;
  118.     v1();
  119.     cout<< "                         | S                          |" << endl;
  120.     v1();
  121.     Sleep(200);
  122.     system("cls");
  123.     v1();
  124.     cout<< "                         | Sc                         |"<< endl;
  125.     v1();
  126.     Sleep(200);
  127.     system("cls");
  128.     v1();
  129.     cout<< "                         | Sco                        |"<< endl;
  130.     v1();
  131.     Sleep(200);
  132.     system("cls");
  133.     v1();
  134.     cout<< "                         | Scor                       |"<< endl;
  135.     v1();
  136.     Sleep(200);
  137.     system("cls");
  138.     v1();
  139.     cout<< "                         | Score                      |            "<< endl;
  140.     v1();
  141.     Sleep(200);
  142.     system("cls");
  143.     v1();
  144.     cout<< "                         | Score:                     |            "<< endl;
  145.     v1();
  146.     Sleep(200);
  147.     system("cls");
  148.     v1();
  149.     cout<< "                         | Score: y                   |            "<< endl;
  150.     v1();
  151.     Sleep(200);
  152.     system("cls");
  153.     v1();
  154.     cout<< "                         | Score: yo                  |            "<< endl;
  155.     v1();
  156.     Sleep(200);
  157.     system("cls");
  158.     v1();
  159.     cout<< "                         | Score: you                 |            "<< endl;
  160.     v1();
  161.     Sleep(200);
  162.     system("cls");
  163.     v1();
  164.     cout<< "                         | Score: you-                |            "<< endl;
  165.     v1();
  166.     Sleep(200);
  167.     system("cls");
  168.     v1();
  169.     cout<< "                         | Score: you-                |            "<< endl;
  170.     v1();
  171.     Sleep(200);
  172.     system("cls");
  173.     v1();
  174.     cout<< "                         | Score: you-"<< score << " |             |"             << endl;
  175.     v1();
  176.     Sleep(200);
  177.     system("cls");
  178.     v1();
  179.     cout<< "                         | Score: you-"<< score << " | c           |"             << endl;
  180.     v1();
  181.     Sleep(200);
  182.     system("cls");
  183.     v1();
  184.     cout<< "                         | Score: you-"<< score << " | co          |"             << endl;
  185.     v1();
  186.     Sleep(200);
  187.     system("cls");
  188.     v1();
  189.     cout<< "                         | Score: you-"<< score << " | com         |"             << endl;
  190.     v1();
  191.     Sleep(200);
  192.     system("cls");
  193.     v1();
  194.     cout<< "                         | Score: you-"<< score << " | comp        |"             << endl;
  195.     v1();
  196.     Sleep(200);
  197.     system("cls");
  198.     v1();
  199.     cout<< "                         | Score: you-"<< score << " | compu       |"             << endl;
  200.     v1();
  201.     Sleep(200);
  202.     system("cls");
  203.     v1();
  204.     cout<< "                         | Score: you-"<< score << " | comput      |"             << endl;
  205.     v1();
  206.     Sleep(200);
  207.     system("cls");
  208.     v1();
  209.     cout<< "                         | Score: you-"<< score << " | compute     |"             << endl;
  210.     v1();
  211.     Sleep(200);
  212.     system("cls");
  213.     v1();
  214.     cout<< "                         | Score: you-"<< score << " | computer    |" << endl;
  215.     v1();
  216.     Sleep(200);
  217.     system("cls");
  218.     v1();
  219.     cout<< "                         | Score: you-"<< score << " | computer-   |" << endl;
  220.     v1();
  221.     Sleep(200);
  222.     system("cls");
  223.     v1();
  224.     cout<< "                         | Score: you-"<< score << " | computer-" << l << "  |" << endl;
  225.     v1();
  226.     Sleep(2000);
  227.     system("cls");
  228.     if (score >= fscore)
  229.     {
  230.         system("cls");
  231.         cout<<"You keep your data... For now" << endl;
  232.         Sleep(3000);
  233.         system("cls");
  234.     }
  235.     else
  236.     {
  237.         system("cls");
  238.         cout<<"Your hdd would've been formatted it this wasnt a test" << endl;
  239.         Sleep(3000);
  240.         system("cls");
  241.     }
  242. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement