Advertisement
TheCountryGamer

Little Bugs in the Code

Mar 28th, 2014
107
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.67 KB | None | 0 0
  1. #include <iostream>
  2.  
  3. using namespace std;
  4.  
  5. int main() {
  6.  
  7.     int bugs = 99;
  8.     string input("");
  9.  
  10.     cout << "Enter 'exit' to end the awesomeness.\n\n";
  11.  
  12.     do {
  13.         cout << bugs << " little bugs in the code" << '\n';
  14.         cout << bugs << " little bugs in the code" << '\n';
  15.         cout << "Take one down, patch it around." << '\n';
  16.         if (bugs <= 5)
  17.             --bugs;
  18.         else
  19.             bugs = rand() % 500 + 1;
  20.        
  21.         string extraText("");
  22.         if (bugs <= 0)
  23.             extraText = "Yay!";
  24.         cout << bugs << " little bugs in the code..." << extraText << '\n';
  25.         if (bugs > 0) {
  26.             cout << "(Next round)";
  27.             getline(cin, input);
  28.             cin.clear();
  29.         }
  30.     } while (input != "exit" && bugs > 0);
  31.  
  32.  
  33.     return 0;
  34. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement