fork download
  1. //OrinTill Qimid CS1A Chapter 4, P. 294, 10
  2. //
  3. /**************************************************************
  4.  * Lotery ticket
  5.  *
  6.  * ____________________________________________________________
  7.  * This program will tell the user if he won the lotery or not.
  8.  * ____________________________________________________________
  9.  * INPUT
  10.  * ticket : The user ticket
  11.  * OUTPUT
  12.  * If the user won or lost the ticket.
  13.  **************************************************************/
  14. #include <iostream>
  15. #include <iomanip>
  16. #include <cmath>
  17. using namespace std;
  18.  
  19. int main()
  20. {
  21. const int SIZE=10;
  22. bool found;
  23. found = false;
  24. int ticket;
  25. int validNums[SIZE] = {13579, 26791, 26792, 33445, 55555,
  26. 62483, 77777, 79422, 85647, 93121};
  27. cout<<"WHats your ticket number?"<<endl;
  28. cin>>ticket;
  29. for (int i = 0; i < SIZE; i++)
  30. {
  31. if (validNums[i] == ticket)
  32. {
  33. found = true;
  34. }
  35.  
  36. }
  37. if (found == true)
  38. {
  39. cout<<"Congrats you are this weeks winner!!!"<<endl;
  40. }
  41. else
  42. {
  43. cout<<"Sorry thats it not please try again next time"<<endl;
  44. }
  45.  
  46.  
  47.  
  48.  
  49. return 0 ;
  50. }
Success #stdin #stdout 0s 5280KB
stdin
Standard input is empty
stdout
Standard output is empty