Im noob

Write your question here.
One of my project has a question and it has 6 different option and i want the user to select 2 option only
The secret to getting good help is asking good, detailed questions.
do you want to force them to pick #2, or are you asking how to let them choose 2 of the 6? It isnt clear. If 2 of the 6, can they pick the same one twice?

Lets take the case of pick 2 of the 6, without repeating...

a crude quick start to it:

char option1, option2;

cout << "words about what they can pick\n";
cin >> option1;
option2 = option1;
while(option2 == option1)
{
cout "you must select 2 distinct options\n";
cout << "words about what they can pick\n";
cin >> option2;
}
...use(option1, option2);

you can add validation that the input is one of the valid choices etc if you like.
Last edited on
Topic archived. No new replies allowed.