Make a loopable menu with the following options:
-Programs 1
-Programs 2
-Exit
The first menu must contain the following programs:
The second menu must contain the following programs:
#include <iostream>
using namespace std;
int main()
{
while (true){
int c;
cout<<"\n1. Program 1 \n2. Program 2\n3. Exit";
cout<<"\nEnter your choice: ";
cin>>c;
if(c==1){
int c2;
cout<<"\n1. Print the letter 'W' with the symbol '*' starting in coordinates 1,1";
cout<<"\n2. Print the letters 'XX' with the symbol '*' starting in coordinate 1,1";
cout<<"\n3. Same program as point 4 (printing squares) but without filling the inside with *'s";
cout<<"\n4. Exit";
cout<<"\nEnter your choice: ";
cin>>c2;
if (c==1){
}
else if (c==2){
}
else if(c==3){
}
else if (c==4){
break;
}
}
else if(c==2){
int c3;
cout<<"\n1. Multiplication Table";
cout<<"\n2. Sum consecutive numbers";
cout<<"\n3. Print squares";
cout<<"\n4. Exit";
cout<<"\nEnter your choice: ";
cin>>c3;
if (c==1){
int a,b;
cout<<"\nEnter first number: ";
cin>>a;
cout<<"\nEnter second number: ";
cin>>b;
for(int i=a;i<=b;i++){
cout<<i<<"*"<<i<<(i*i);
}
}
else if (c==2){
}
else if(c==3){
}
else if (c==4){
break;
}
}
else if(c==3){
break;
}
}
return 0;
}
Comments
Leave a comment