I'm supposed to be gathering input of numbers until the user types '0'. Also once the user decides to exit the loop, the user can decide whether to start again or not. How do I fix my program? Or is there another way that is more efficient to deliver this program?
`
int regular, special, vip;
int i;
bool flag = true;
while(flag)
{
cout << "input please: ";
cin >> i;
if ((i <10000) && (i > 0))
{
regular++;
}
if ((i >10000) && (i<=50000))
{
special++;
}
if (i > 50000)
{
vip++;
}
if (i==0);
{
flag = false;
cout << "Your branch has " << regular << " Regular Customers, "
<< special << " Special Customers and " << vip << " VIP Customers"
<< "Try again? [1 = yes/ 0 = no] " << endl;
}
}
}`
Aucun commentaire:
Enregistrer un commentaire