Lottery code won't work!

javascript:tx('code')javascript:editbox1.editTag('#include<iostream>
#include<string>
#include<ctime>
using namespace std;


int main()
{
int num;

srand(time(NULL));
num = rand() % 7 + 1;

int pick1; int pick2; int pick3;



{
cout << "It's lottery time!\n";

int win = 0;

do{



cout << "Choose a number between 1 and 7\n" << num;

cin >> pick1;
{
if (pick1 == num)

{
win = 1,

cout << "You got it! You win the prize!\n";
}

if (pick1 > num)

{
cout << "That number is too big. Try again!\n";
}

if (pick1 < num)

{
cout << "That number is too small. Try again!\n";

}
}

cout << "Second pick\n";

cin >> pick2;
{
if (pick2 == num)

{
win = 1,
cout << "You got it! You win the prize!\n";


}

if (pick2 > num)

{
cout << "That number is too big. Try one more time!\n";

}



if (pick2 < num)

{
cout << "That number is too small. Try one more time!\n";

}



cout << "Final pick\n";

cin >> pick3;
{
if (pick3 == num)
win = 1,

cout << "You got it! You win the prize!\n";

}
{
if (pick3 > num)
win++;
cout << "That number is too big. Sorry. You lose.\n";
}
{
if (pick3 < num)
win++;
cout << "That number is too small. Sorry. You lose.\n";
}
}
}

while (win == 0);
}



system("pause");


}

')


This code has problems. Please show me how to fix it. Sorry if it's not in code form on the forum. The code feature won't work for me. All it did was place this

javascript:tx('code')

Last edited on
Topic archived. No new replies allowed.