uhh. this wont work. it sais it has something to do with the system("PAUSE);
#include <stdio.h> #include <math.h> int main (void) { float diameter, area, radius, circumference, choice; float number1, number2, number3, answer, choice2; char function; printf("SUPER CALCULATOR\n"); printf("------------------------------------\n \n"); printf(" 1 = Circumference of a Circle\n \n 2 = Area of a Circle\n \n"); printf(" 3 = Area of Cylinder\n \n 4 = Cylinder Surface Area\n \n"); printf(" 5 = Area of a Rectangle/Rectangular Prism\n \n 6 = Perimeter of a Rectangle\n \n"); printf(" 7 = Cube Surface Area\n \n 8 = Triangle Area\n \n 9 = Pyramid Area\n \n"); printf(" 10 = ^2 Root\n \n \t - "); scanf("%f", &choice); if (choice == (float)1) { printf("What is the diameter of the circle?\n \n \t - "); scanf("%f", &diameter); circumference = diameter * 3.14; printf("\n \n \t Circumference = %f units\n \n", circumference); } if (choice == (float)2) { printf("What is the radius of the circle???\n \n \t - "); scanf("%f", &radius); area = (radius * radius) * 3.14; printf("\n \t Area = %f units^2\n \n", area); } if (choice == (float)3) { printf("What is the radius of the cylinder???\n \n \t - "); scanf("%f", &number1); printf("What is the height of the cylinder???\n \n \t - "); scanf("%f", &number2); answer = ((number1 * number1) * 3.14) * number2; printf("\n %f units^3\n \n", answer); } if (choice == (float)4) { printf("What is the diameter of the cylinder???\n \n \t - "); scanf("%f", &number1); printf("what is the height of the cylinder???\n \n \t - "); scanf("%f", &number2); answer = (((number1 * number1) * 3.14) * 2) + (((number1 * 2) * 3.14) * number2); printf("\n %f units^2\n \n", answer); } if (choice == (float)5) { printf("What is the width of the rectangle?\n \n \t - "); scanf("%f", &number1); printf("What is the height of the rectangle?\n \n \t - "); scanf("%f", &number2); printf("Is the figure a rectangular prism? 1 = yes, 2 = no\n \n \t - "); scanf("%f", &choice2); if (choice2 == (float)1) { printf("What is the length of the rectangular prism?\n \n \t - "); scanf("%f", &number3); answer = number1 * number2 * number3; printf("\n \n \t Area = %f units^3\n \n", answer); } if (choice2 == (float)2) { answer = number1 * number2; printf("\n \n \t Area = %f units^2\n \n", answer); } } if (choice == (float)6) { printf("what is the width of the rectangle???\n \n \t - "); scanf("%f", &number1); printf("what is the height of the rectangle???\n \n \t - "); scanf("%f", &number2); answer = (number1 * 2) + (number2 * 2); printf("\n \n \t Perimeter = %f units\n \n", answer); }; if (choice == (float)7) { printf("what is the width of the rectangular prism???\n \n \t - "); scanf("%f", &number1); printf("what is the height of the rectangular prism???\n \n \t - "); scanf("%f", &number2); printf("what is the length of the rectangular prism???\n \n \t - "); scanf("%f", &number3); answer = ((number1 * number2) * 2) + ((number2 * number3) * 2) + ((number3 * number1) * 2); printf("\n %f units^2\n \n", answer); } if (choice == (float)8) { printf("What is the height of the triangle???\n \n \t - "); scanf("%f", &number1); printf("what is the width of the triangle???\n \n \t - "); scanf("%f", &number2); answer = (number1 * number2) / 2; printf("\n %f units^2\n \n", answer); } if (choice == (float)9) { printf("pyramid width\n \n \t - "); scanf("%f", &number1); printf("pyramid length\n \n \t - "); scanf("%f", &number2); printf("pyramid height\n \n \t - "); scanf("%f", &number3); answer = (number1 * number2 * number3) / 2; printf("\n %f units^3\n \n", answer); } if (choice == (float)10) { printf("number\n \n \t - "); scanf("%f", &number1); answer = sqrt(number1); printf("%f", answer); } } system("PAUSE"); return 0; }
what is wrong?
matt wuz here
|