Convert the Switch Statement into an If/else statement (C++Form) #include <iostr
ID: 3617531 • Letter: C
Question
Convert the Switch Statement into an If/else statement (C++Form)#include <iostream>
using namespace std;
int menu();
void printmenu();
void enter(int &,string[],string[],int[]);
void search(int ,string[],string[],int[]);
void sort(int ,string[],string[],int[]);
int main()
{ string course[100],prof[100];
int cap[100],choice,count=0;
choice=menu();
while(choice!=4)
{switch(choice)
{case1:enter(count,course,prof,cap);
break;
case2:search(count,course,prof,cap);
break;
case3:sort(count,course,prof,cap);
break;
}
choice=menu();
}
return 0;
}
Explanation / Answer
please rate - thanks since any errors in input are already taken care of you don't needa final catall else #include using namespace std; int menu(); void printmenu(); void enter(int &,string[],string[],int[]); void search(int ,string[],string[],int[]); void sort(int ,string[],string[],int[]); int main() { string course[100],prof[100]; int cap[100],choice,count=0; choice=menu(); while(choice!=4) {if(choice==1) enter(count,course,prof,cap); else if(choice==2) search(count,course,prof,cap); elseif(choice==3) sort(count,course,prof,cap); choice=menu(); } return 0; } void sort(int n,string c[],string p[],int cap[]) {int i,j,t; string st; coutRelated Questions
Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.