cs161AWinter2024/switchLoop.cpp

26 lines
486 B
C++

#include <iostream>
using namespace std;
int main(){
char option;
cout << "Enter any letter (but q exits)" << endl;
cin >> option;
while(option != 'q'){
switch(option){
case 'a':
cout << "You pressed a" << endl;
break;
case 'b':
cout << "Bee is a bug" << endl;
break;
default:
cout << "That's a nice letter too" << endl;
}
cout << "Enter any letter (but q exits)" << endl;
cin >> option;
}
return 0;
}