1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164
|
// List the equations they can choose from:
std::cout << "Equation :: [Required Values]:\n" << std::endl;
std::cout << "\t1) s = ut + 1/2(at^2) \t\t\t:: [u,t,a]\n";
std::cout << "\t2) u = (s - 1/2at^2)/t \t\t:: [s,a,t]\n"; //I did not w write this part of the program. I will credit the source and writer of the program.
std::cout << "\t3) a = (2s - ut)/t^2 \t\t:: [s,u,t]\n\n";
std::cout << "\t4) s = 1/2(u+v)t \t\t\t:: [u,v,t]" << std::endl;
std::cout << "\t5) u = (2s - v)/t \t\t:: [s,v,t]\n";
std::cout << "\t6) v = (2s - u)/t \t\t:: [s,u,t]\n";
std::cout << "\t7) t = 2s / u+v \t\t:: [s,u,v]\n\n";
std::cout << "\t8) v = u + at \t\t\t\t:: [u,a,t]" << std::endl;
std::cout << "\t9) u = v - at \t\t\t:: [v,a,t]\n";
std::cout << "\t10) a = (v - u)/t \t\t:: [v,u,t]\n";
std::cout << "\t11) t = (v - u)/a \t\t:: [v,u,a]\n\n";
std::cout << "\t12) v^2 = u^2 + 2as \t\t\t:: [u,a,s]" << std::endl;
std::cout << "\t13) v = sqrt(u^2 + 2as) \t:: [u,a,s]\n";
std::cout << "\t14) u = sqrt(v^2 - 2as) \t:: [v,a,s]\n";
std::cout << "\t15) a = sqrt((v^2 - u^2)/2s) \t:: [v,u,s]\n";
std::cout << "\t16) s = (v^2 - u^2)/2a \t\t:: [v,u,a]\n" << std::endl;
// Find out what equation they would like to use:
std::cout << "Please choose an equation(1-16): "; std::cin >> equationChoice;
// Gather Variables:
std::cout << "Please enter the values you have below(If unknown use 0):\n" << std::endl;
std::cout << "S: "; std::cin >> s;
std::cout << "U: "; std::cin >> u;
std::cout << "V: "; std::cin >> v;
std::cout << "A: "; std::cin >> a;
std::cout << "T: "; std::cin >> t;
std::cout << std::endl;
switch(equationChoice)
{
case 1:
std::cout << "S = " << (u*t) + ((a*pow(t,2))/2) << std::endl;
break;
case 2:
std::cout << "U = " << ((s - ((a*pow(t,2))/2))/t) << std::endl;
break;
case 3:
std::cout << "A = " << ((2*s-u*t)/pow(t,2)) << std::endl;
break;
case 4:
std::cout << "S = " << (((u+v)*t)/2) << std::endl;
break;
case 5:
std::cout << "U = " << (((2*s)-v)/t) << std::endl;
break;
case 6:
std::cout << "V = " << (((2*s)-u)/t) << std::endl;
break;
case 7:
std::cout << "T = " << ((2*s)/u+v) << std::endl;
break;
case 8:
std::cout << "V = " << (u + (a*t)) << std::endl;
break;
case 9:
std::cout << "U = " << (v - (a*t)) << std::endl;
break;
case 10:
std::cout << "A = " << ((v-u)/t) << std::endl;
break;
case 11:
std::cout << "T = " << ((v-u)/a) << std::endl;
break;
case 12:
std::cout << "V^2 = " << ((pow(u,2))+(2*a*s)) << std::endl;
break;
case 13:
std::cout << "V = " << sqrt((pow(u,2))+(2*a*s)) << std::endl;
break;
case 14:
std::cout << "U = " << sqrt((pow(v,2))-(2*a*s)) << std::endl;
break;
case 15:
std::cout << "A = " << (((pow(v,2))-(pow(u,2)))/(2*s)) << std::endl;
break;
case 16:
std::cout << "S = " << (((pow(v,2))-(pow(u,2)))/(2*a)) << std::endl;
break;
default:
std::cout << "It appears you have made an error, please try again.\n\n" << std::endl;
main();
break;
}
std::cin.sync();
std::cin.get();
return 0;
}
if (choice == 3)
{
printf("Do you want to find the area/circumference of a segment or a whole circle?\n");
printf("\n Enter 1 for a whole circle \n Enter 2 for a segment \n"); //Menu for the circle calculator
cin >> choicecirc;
if (choicecirc == 1)
{
printf("Enter the radius of the circle: \t");
scanf("%f",&r);
cir = 2 * PI * r;
area = PI * r * r;
printf("The circumference of the circle is: \t %f cm \n",cir);
printf("\n");
printf("The area of the circle is: \t %f cm^2 \n ",area);
printf("Press ENTER to terminate the program"); // Without this the program terminates instantly.
fflush(stdout);
getchar();
getchar();
return 0;
}
else if (choicecirc == 2)
{
printf("Enter the radius of the segment: \t");
scanf("%f", &segr); //This part of the circle calculator calculates segments
printf("Enter the angle size in degrees of the segment: \t");
scanf("%f", &theta);
segcir = (theta/360) * 2 * PI * segr;
segarea=(theta/360) * PI * segr * segr;
printf("The circumference of the segment is: \t %f cm \n", segcir);
printf("The area of the segment is: \t %f cm^2 \n", segarea);
printf("Press ENTER to terminate the program"); // Without this the program terminates instantly.
fflush(stdout);
getchar();
getchar();
return 0;
}
// More code to come here
if (choice > 4)
printf("There aren't that many features in the program yet!\n ");
printf("Press ENTER to terminate the program"); // Without this the program terminates instantly.
fflush(stdout);
getchar();
getchar();
return 0;
}
}
//Writen by Cameron who is a beginner at C/C++
//Started development on the 12Th April 2012
|