we were given a project by our teacher, she told us we can make any program at our interest but it must have conditional statements and Looping.. i was planning to make a converter(e.g. convert meters to km, lbs to kg, sec to hr.) i made this draft.. but thinking how many formulas and menus i have to make i dont know how to simplify my code. i need to get this done by a week.. any help about for project will be much appreciated..
ill keep posting my codes to show you guys my process of work..
CODE
#include<stdio.h>
#include<conio.h>
main()
{
char ans,try,y,n,a,b,c,d,e;
clrscr();
gotoxy(37,12);
printf("CONVERTER 2008\n");
try_again:
printf("What do you want to convert?");
printf("\nA:AREA\nB:MASS\nC:LENGTH\nD:TEMPERATURE\nE:TIME");
ans=getche();
clrscr();
switch(ans)
{
case 'a':
case 'A':
printf("What unit of area do you want to convert?");
/* i still need to put menus for different types of areas */
break;
case 'b':
case 'B':
printf("What unit of mass do you want to convert?");
break;
/* i still need to put menus for different types of mass conversions*/
case 'c':
case 'C':
printf("What unit of Length do you want to convert?");
break;
/* i still need to put menus for different types of length conversions */
case 'd':
case 'D':
printf("What temperature do you want to convert?");
break;
/* i still need to put menus for different types of temp conversions */
case 'e':
case 'E':
printf("What unit of time do you want to solve?");
break;
default:
printf("\n%c is not in the choices.", ans);
printf("\nWant to try again<Y/N>? ");
try=getche();
switch(try)
{
case 'y':
case 'Y':
clrscr();
goto try_again;
case 'n':
case 'N':
break;
default:
break;
}
}
getch();
}
god bless guys
any suggestions will be very helpful to me!!
This post has been edited by angel0lz: 19 Jul, 2008 - 08:04 AM