I am creating a simple code to take integer value 10 times. If at any point, the users enters the value '5', the system should print a message, "You entered 5, you lose". Here is the code
int main()
{
int num = 0;
int i;
for (i = 1; i<= 10; i++)
{
cout << "Enter a number other than 5\n";
cin >> num;
if (num == 5)
{
cout << "Hey, you entered 5. You lose!\n";
break;
}
}
cout << "You win!";
return 0;
}
Now what I dont know is, how do close the program after users enters 5. I am very new to coding so Im really sorry if this question sound stupid. Also, it would be vet nice of you if you could explain in the most easiest way you can. Thank you