Listing 9
void doSomething(){
//Begin sequence structure
int temp = 0;
cout << "Enter an integer, 1-3 inclusive: ";
cin >> temp;
//End sequence structure
//Begin nested selection structures
if(temp == 1){
cout << "Thanks for the 1" << endl;
}else
if(temp == 2){
cout << "Thanks for the 2" << endl;
}else
if(temp == 3){
cout << "Thanks for the 3" << endl;
}else{
cout << "Invalid input" << endl;
}//end else
//End selection structure
}//end doSomething function
Listing 9
|