Bij volgend klein programma is het de bedoeling dat er gevraagd wordt naar een waarde om later te kunnen gebruiken, maar als ik nu een geldige waarde ingeef of niet, toch blijft de loop doorgaan, ookal geldt het argument niet!
Hoe komt dit en wat moet ik eraan doen??
#include <iostream>
using namespace std;
char choise;
int commando=1;
int main()
{
for (choise=0;!(choise<3&&choise>1);commando++)// choise<3 en choise>1 dan stoppen
{
cout<<"press 1 to change the leap(difference) \npress 2 to change the amount of numbers per line \npress 3 to (re)start the programm\ncommando " <<commando<<":\n";
cin>>choise;
cout<<"your choise: "<<choise<<"\n";
}//end for-loop
return 0;
}
Hoe komt dit en wat moet ik eraan doen??
#include <iostream>
using namespace std;
char choise;
int commando=1;
int main()
{
for (choise=0;!(choise<3&&choise>1);commando++)// choise<3 en choise>1 dan stoppen
{
cout<<"press 1 to change the leap(difference) \npress 2 to change the amount of numbers per line \npress 3 to (re)start the programm\ncommando " <<commando<<":\n";
cin>>choise;
cout<<"your choise: "<<choise<<"\n";
}//end for-loop
return 0;
}