Question: Need help to turn this code to java program so i could run it on bluej #include #include using namespace std; int main() { int
Need help to turn this code to java program so i could run it on bluej
#include
#include
using namespace std;
int main()
{
int Temp[5], User[5];
for(int i = 0; i < 5; i++)
{
// Temp[i] = rand() %(high - low + 1) + low;
Temp[i] = rand()%(70 - 1 + 1) + 1;
}
for (int i = 0; i < 5; i++)
{
cout << "Enter the " << i+1 << " Number to win lottery (between 1 to 70) :: ";
cin >> User[i];
}
int win = 0;
for (int i = 0; i < 5; i++)
{
for (int j = 0; j < 5 ; j++)
{
if (User[i] == Temp[j])
win++;
}
}
if (win > 0)
{
cout << endl << "You have won " << win << " Lotteries out of 5" << endl;
}
else
{
cout << endl << "Better Luck Next Time" << endl;
}
cout << endl << "Winning numbers are :: ";
for (int i = 0; i < 5; i++) {
cout << Temp[i] << " ";
}
cout << endl;
return 0;
}
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
