Uhhhhh yes

This commit is contained in:
Tyler Beckman 2024-08-25 20:44:35 -06:00
parent 351f3f4093
commit 4247e4fecb
Signed by: Ty
GPG key ID: 2813440C772555A4
2 changed files with 162 additions and 118 deletions

View file

@ -1,3 +1,39 @@
IndentWidth: 4
UseTab: Always
TabWidth: 4
InsertBraces: false
SortIncludes: true
IncludeBlocks: Regroup
IncludeCategories:
# System headers from C
- Regex: '<(cassert|ccomplex|cctype|cerrno|cfenv|cfloat|cinttypes|ciso646|climits|clocale|cmath|csetjmp|csignal|cstdalign|cstdarg|cstdatomic|cstdbool|cstddef|cstdint|cstdio|cstdlib|cstdnoreturn|cstring|ctgmath|cthreads|ctime|cuchar|cwchar|cwctype)>'
Priority: 3
# System headers without extension.
- Regex: '<([A-Za-z0-9\Q/-_\E])+>'
Priority: 2
# Local headers with extension.
- Regex: '"([A-Za-z0-9\Q/-_\E])+\.h(pp)?"'
Priority: 1
BraceWrapping:
AfterCaseLabel: false
AfterClass: false
AfterControlStatement: Never
AfterEnum: false
AfterFunction: false
AfterNamespace: false
AfterObjCDeclaration: false
AfterStruct: false
AfterUnion: false
AfterExternBlock: false
BeforeCatch: false
BeforeElse: false
BeforeLambdaBody: false
BeforeWhile: false
SplitEmptyFunction: false
SplitEmptyRecord: false
SplitEmptyNamespace: false
IndentCaseLabels: true
IntegerLiteralSeparator:
Binary: 0
Decimal: 3
Hex: -1

View file

@ -56,7 +56,8 @@ double stress(double force, double area) { return force / area; }
double shear_stress(double sigma_x, double sigma_y, double tau_xy,
double theta) {
return -0.5 * (sigma_x - sigma_y) * sin(2 * theta) + tau_xy * cos(2 * theta);
return -0.5 * (sigma_x - sigma_y) * sin(2 * theta) +
tau_xy * cos(2 * theta);
}
double coulombs_law(double charge_1, double charge_2,
@ -98,9 +99,10 @@ int main() {
<< "[9] Stress" << std::endl
<< "[10] Shear Stress" << std::endl
<< "[11] Coulomb's law" << std::endl;
int equation = input_double("Which equation would you like to calculate?");
int equation =
input_double("Which equation would you like to calculate?");
std::string output = "";
double output;
switch (equation) {
case 0:
@ -129,15 +131,17 @@ int main() {
input_double("Please input the distance between objects"));
break;
case 5:
output =
pythagorean_theorem(input_double("Please input the x distance"),
output = pythagorean_theorem(
input_double("Please input the x distance"),
input_double("Please input the y distance"));
break;
case 6:
output = sphere_volume(input_double("Please input the sphere radius"));
output = sphere_volume(
input_double("Please input the sphere radius"));
break;
case 7:
output = deflection(input_double("Please input the force of weight"),
output = deflection(
input_double("Please input the force of weight"),
input_double("Please input the length"),
input_double("Please input the elasticity modulus"),
input_double("Please input the moment of inertia"));
@ -149,19 +153,22 @@ int main() {
input_double("Please input the change in temperature"));
break;
case 9:
output = stress(input_double("Please input the amount of force"),
output =
stress(input_double("Please input the amount of force"),
input_double("Please input the surface area"));
break;
case 10:
output = shear_stress(
input_double("Please enter σ_x"), input_double("Please enter σ_y"),
input_double("Please enter τ_xy"), input_double("Please enter θ"));
output = shear_stress(input_double("Please enter σ_x"),
input_double("Please enter σ_y"),
input_double("Please enter τ_xy"),
input_double("Please enter θ (in radians)"));
break;
case 11:
output = coulombs_law(
input_double("Please input the first charge"),
input_double("Please input the second charge"),
input_double("Please input the relative static permittivity"),
input_double(
"Please input the relative static permittivity"),
input_double("Please input the distance between charges"));
break;
default:
@ -169,6 +176,7 @@ int main() {
<< std::endl;
continue;
}
std::cout << "The result of that calculation is: " << output << std::endl;
std::cout << "The result of that calculation is: " << output
<< std::endl;
}
}