Created
April 23, 2016 16:33
-
-
Save Signifies/2aed3a8b8558419739379cffccb890be to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <iostream> | |
#include <cctype> | |
#include <iomanip> | |
#include <fstream> | |
#include <string> | |
using namespace std; | |
/*Student Name: Evan Stuehmer | |
Course: COP 2000 | |
Instructor: Calvert | |
Assignment | |
Code URL: https://gist.github.com/ES359/433e6652b4eff344f7d4 | |
*/ | |
int main() | |
{ | |
int size = 5; | |
int randomArray[5]; | |
const int MIN = 1; | |
const int MAX = 9; | |
unsigned seed = time(0); | |
srand(seed); | |
int random = (rand() % (MAX - MIN)) + MIN; | |
int random1 = (rand() % (MAX - MIN)) + MIN; | |
//cout << random << endl << random1 << endl; | |
for (int i = 0; i < size; i++) | |
{ | |
randomArray[i] = random; | |
cout << "Complete." << endl; | |
} | |
const int LotSize = 4; | |
int lottery[LotSize]; | |
for (int i = 0; i <= LotSize; i++) | |
{ | |
cout << "Please input five numbers." << endl; | |
cin >> lottery[i]; | |
cout << "Complete."; | |
} | |
bool arraysEqual = true; // Flag variable | |
int count = 0; | |
while (arraysEqual && count < size) | |
{ | |
if (randomArray[count] != lottery[count]) | |
{ | |
count++; | |
arraysEqual = false; | |
} | |
} | |
if (arraysEqual) | |
{ | |
cout << "You won the lottery!"; | |
} | |
else { | |
cout << "You failed, sorry!" ; | |
} | |
return 0; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment