#include <iostream> using namespace std; void program1(){ //1st program here pri
ID: 3904014 • Letter: #
Question
#include <iostream>
using namespace std;
void program1(){
//1st program here
printf("1st Program running");
}
void program2(){
//1st program here
printf("2st Program running");
}
void program3(){
//1st program here
printf("3rd Program running");
}
void program4(){
//1st program here
printf("4th Program running");
}
int main(int argc, char **argv)
{
while(1==1){
printf("1. Week 1 - Compute Diameter of a circle");
printf("2. Week 2 - Calculate Weekly Pay");
printf("3. Week 3 - ");
printf("4. Week 4 - ");
printf("5. Exit");
printf("Enter an option: ");
int choice;
cin>>choice;
switch(choice){
case 1:
program1();
break;
case 2:
program2();
break;
case 3:
program3();
break;
case 4:
program4();
}
if(choice==5){
printf("Exiting!!");
break;
}
}
return 0;
}
i need help putting this in C all the way. its in C++ right now...
Explanation / Answer
Below is your code in C
#include <stdio.h>
void program1(){
//1st program here
printf("1st Program running ");
}
void program2(){
//1st program here
printf("2st Program running ");
}
void program3(){
//1st program here
printf("3rd Program running ");
}
void program4(){
//1st program here
printf("4th Program running ");
}
void main()
{
while(1==1){
printf("1. Week 1 - Compute Diameter of a circle ");
printf("2. Week 2 - Calculate Weekly Pay ");
printf("3. Week 3 - ");
printf("4. Week 4 - ");
printf("5. Exit ");
printf("Enter an option: ");
int choice;
scanf("%d",&choice);
switch(choice){
case 1:
program1();
break;
case 2:
program2();
break;
case 3:
program3();
break;
case 4:
program4();
}
if(choice==5){
printf("Exiting!!");
break;
}
}
}
Related Questions
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.