Don't like ads? PRO users don't see any ads ;-)
Guest

Untitled

By: a guest on May 6th, 2012  |  syntax: None  |  size: 0.71 KB  |  hits: 11  |  expires: Never
download  |  raw  |  embed  |  report abuse  |  print
Text below is selected. Please press Ctrl+C to copy to your clipboard. (⌘+C on Mac)
  1. # include <iostream>
  2. # include <conio.h>
  3. # include <time.h>
  4.  
  5. using namespace std;
  6.  
  7.  
  8. void randComp(int *comp)
  9. {
  10.  
  11.         *comp = rand()%10;
  12. }
  13. void comparing(int hum,int comp,int count)
  14. {
  15.         if(hum == comp)
  16.         {
  17.                 count++;
  18.  
  19.         }
  20.         else
  21.                 count--;
  22. }
  23. bool endGame(int count)
  24. {
  25.         if (count != 0)
  26.                 true;
  27.         else
  28.                 return 0;
  29. }
  30.  
  31.  
  32. int main()
  33. {
  34.         int count ;
  35.         int hum;
  36.         int comp;
  37.         srand (time(NULL));
  38.         cout << "put your money"<<"\n";
  39.         cin >> count;
  40.        
  41.        
  42.         for ( ; ; )
  43.         {
  44.                 cout << "put the nuber"<<"\n";
  45.                 cin >> hum;
  46.                 randComp(&comp);
  47.                 cout << "comp"<< '-' << comp<<"\n";
  48.                 comparing(hum,comp,count);
  49.                 cout << "count is"<< ' - ' << count<<"\n";
  50.                 endGame(count);
  51.  
  52.  
  53.         }
  54.         getch ();
  55.         return 0;
  56. }