hi,I have a problem here.
#include "stdafx.h"
int main()
{
int speed, dist, time, force, mass, masss, accel, velo, moment;
int choice, choose;
char pilih, pick;
do{
printf("\t\t\tWelcome to Physics (Force and Motion)\n");
printf("\t\t***************************************************\n");
printf("\t\t\tCHOOSE SECTION\n\n");
printf("\t1. FORCE\n");
printf("\t2. SPEED\n");
printf("\t3. MOMENTUM\n");
printf("\t4. END\n\n");
printf("Choice: ");
scanf("%d", &choice);
switch(choice){
case 1:
do{
printf("\n\t\tCHOOSE WHICH SECTION\n");
printf("\t1. Info\n");
printf("\t2. Calculation\n");
printf("\t3. End\n");
printf("Choice: ");
scanf("%s", &pilih);
switch(pilih){
case '1':
printf("Force = Mass * Acceleration\n");
printf("The unit is Newton\n");
break;
case '2':
printf("Force = Mass * Acceleration\n\n");
printf("Input Mass in kilogram: ");
scanf("%d", &mass);
printf("Input Acceleration in meter per second second: ");
scanf("%d", &accel);
force = mass * accel;
printf("Force is %d\n", force);
break;
case '3':
printf("End\n");
break;
default:
printf("Invalid section\n");
}break;
}while(pilih !=1);
case 2:
do{
printf("\t\t\tCHOOSE WHICH SECTION\n");
printf("1.Info\n");
printf("2.Calculation\n");
printf("3.End\n");
printf("Choice: ");
scanf("%d", &choose);
switch(choose){
case 1:
printf("Speed = Distance Taken / Time\n");
printf("The unit in meter per second\n");
break;
case 2:
printf("Speed = Distance Taken / Time\n");
printf("Input distance in meter:");
scanf("%d", &dist);
printf("Input time in second:");
scanf("%d", &time);
speed=dist/time;
printf("Speed is %d\n", speed);
break;
case 3:
printf("End\n");
break;
default:
printf("Invalid section\n");
}
}while(choose !=2);
case 3:
do{
printf("\t\t\tCHOOSE WHICH SECTION\n");
printf("1.Info\n");
printf("2.Calculation\n");
printf("3.End\n");
printf("Choice: ");
scanf("%s", &pick);
switch(pick){
case '1':
printf("Momentum = Mass * Velocity\n");
printf("The unit in kilogram meter per second\n");
break;
case '2':
printf("Momentum = Mass * Velocity\n");
printf("Input Mass in kilogram:");
scanf("%d", &masss);
printf("Input Velocity in meter per second:");
scanf("%d", &velo);
moment=masss*velo;
printf("Momentum is %d", moment);
break;
case '3':
printf("End\n");
break;
default:
printf("Invalid section\n");
}
}while(pick !=3);
case 4:
printf("Thank you for using this program\n\n");
printf("This program are made by Jakuzzi group\n\n");
printf("The creator are:\n\n");
printf("\t1.MOHAMAD JEFFRI BIN LEE MOHD. RAMLI\n");
printf("\t2.AMAR BIN MOHD. MARITI\n");
printf("\t3.WAN NORAIMI BINTI ZAINAL ABIDIN\n");
printf("\t4.MUHAMMAD DANIAL BIN ISMAIL\n\n");
printf("\tFrom Mecha 2 Sem 2 2008\n");
printf("\tGERMAN-MALAYSIAN INSTITUTE\n");
break;
default:
printf("Invalid selection\n");
}
}while(choice !=4);
return 0;
}
well, as you can see, this is a very simple physics program we made for a simple assignment.
the problem is we dont know how to make it return to the main menu from the line 51,83, and 125.
we're new in this field and any help will be greatly appreciated. =]