Ok here is an edited version of my code. I would appreciate any input (good or bad).
Code:
#include <stdio.h>
#include <stdlib.h>
int main(int argc, char *argv[])
{
int num1,num2,plus,sub,le,ar,he,main,a,mul;
printf("-----------------------------------------\n"
"Welcome to my simple Calculation Program!\n"
"-----------------------------------------\n"
"(c) copyright 2005 James L. Curtis\n"
"-----------------------------------------\n");
system("PAUSE");
system("CLS");
printf(" Main Menu \n");
printf("-> 1 - Addition\n");
printf("-> 2 - Subtraction\n");
printf("-> 3 - Multiplication(coming soon)\n");
printf("-> 4 - Area Calculation\n");
printf("-> ");
scanf("%d", &main);
switch (main) {
case 1:
printf("Please enter a number ");
scanf("%d",&num1);
printf("Please enter another number ");
scanf("%d",&num2);
plus = (num1+num2);
printf("Your answer is %d\n\n",plus);
break;
case 2:
printf("Please enter a number ");
scanf("%d",&num1);
printf("Enter the ammount you wish to subtract from the first number ");
scanf("%d",&num2);
sub = (num1-num2);
printf("Your answer is %d\n\n",sub);
break;
case 3:
printf("Please enter a number ");
scanf("%d",&num1);
printf("Enter the ammount you wish to multiply the first by ");
scanf("%d",&num2);
mul = (num1*num2);
printf("Your answer is %d\n\n",mul);
break;
case 4:
printf(" Select the shape you wish to calculate the area of\n");
printf("-> 1 - Square\n");
printf("-> 2 - Rectangle\n");
printf("-> 3 - Circle (Comming soon)\n");
printf("-> ");
scanf("%d", &a);
if(a == 1){
printf("Please enter the length of one side of the square: ");
scanf("%d",&le);
printf("\n");
ar = (le*le);
printf("The area of the square is %d",ar);
printf("\n\n");
}
else if(a == 2){
printf("Please enter the length of the rectangle: ");
scanf("%d",&le);
printf("Please enter the heigth of the rectangle: ");
scanf("%d",&he);
ar = (le*he);
printf("The area of the square is %d",ar);
printf("\n\n");
}
break;
}
printf("Thank you for using Curtis Calculator v1.2\n\nTo report any errors or to send ideas for future versions\n"
"Please E-mail me at [email protected] \n\n");
system("PAUSE");
return 0;
}