Skip to content

Commit

Permalink
modified
Browse files Browse the repository at this point in the history
  • Loading branch information
jesushilarioh committed Jun 13, 2020
1 parent 1e6773d commit 7d96aa0
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 13 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -26,13 +26,14 @@
**/
#include <iostream>
#include <vector>

using namespace std;

void getUserNumbers(int[], const int);

void findDuplicateNumbers(vector<int> &);

void getMatchingDigits(vector<int>,
void getMatchingDigits(const vector<int>,
vector<int> &,
const int[],
int &,
Expand All @@ -44,6 +45,7 @@ void displayInfo(const int[],
const int,
const int);


int main()
{
const int ARRAY_SIZE = 5;
Expand All @@ -56,24 +58,24 @@ int main()
getUserNumbers(user_numbers, ARRAY_SIZE);

for (int i = 0; i < ARRAY_SIZE; i++)
duplicate_numbers.push_back(user_numbers[i]);
duplicate_numbers.push_back(user_numbers[i]); // 5 5 7 8 9

findDuplicateNumbers(duplicate_numbers);

getMatchingDigits(duplicate_numbers,
matching_digits,
lottery_numbers,
total_matching_digits,
ARRAY_SIZE);

displayInfo(user_numbers,
lottery_numbers,
matching_digits,
total_matching_digits,
ARRAY_SIZE);

return 0;
}
} // End int main()

void getUserNumbers(int user_numbers[], const int ARRAY_SIZE)
{
Expand Down Expand Up @@ -114,7 +116,7 @@ void findDuplicateNumbers(vector<int> &duplicate_numbers)
}
}

void getMatchingDigits(vector<int> duplicate_numbers,
void getMatchingDigits(const vector<int> duplicate_numbers,
vector<int> &matching_digits,
const int lottery_numbers[],
int &total_matching_digits,
Expand Down Expand Up @@ -161,4 +163,4 @@ void displayInfo(const int user_numbers[],

if(total_matching_digits == ARRAY_SIZE)
cout << "You are the grand prize winner!!" << endl;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -28,10 +28,10 @@

using namespace std;

void readFileContentsIntoVector(vector<string> &, string);
void readFileContentsIntoVector(vector<string> &, const string);
void showMenu();
bool checkIfValueInVector(vector<string>, string);
void displayIfAmongMostPopular(vector<string>, string);
bool checkIfValueInVector(const vector<string>, const string);
void displayIfAmongMostPopular(const vector<string>, const string);
int inputValidate(int);
void program(const vector<string>, const vector<string>);

Expand Down Expand Up @@ -110,7 +110,7 @@ int inputValidate(int number)

}

void readFileContentsIntoVector(vector<string> &vector, string file_name)
void readFileContentsIntoVector(vector<string> &vector, const string file_name)
{
ifstream inputFile;

Expand Down Expand Up @@ -147,7 +147,7 @@ void showMenu()

}

bool checkIfValueInVector(vector<string> vector, string value)
bool checkIfValueInVector(const vector<string> vector, const string value)
{
bool value_exists = false;
for(int i = 0; i < vector.size(); i++)
Expand All @@ -159,7 +159,7 @@ bool checkIfValueInVector(vector<string> vector, string value)
return value_exists;
}

void displayIfAmongMostPopular(vector<string> vector, string name)
void displayIfAmongMostPopular(const vector<string> vector, const string name)
{
cout << endl
<< name
Expand Down

0 comments on commit 7d96aa0

Please sign in to comment.