Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

help with issue for this code: in C++ the I don't have equations.h to include. is there any way around it? or how to get

help with issue for this code: in C++ the I don't have "equations.h" to include. is there any way around it? or how to get that file?

//main.c #include "equations.h" int main(void) { while(0 == 0) { // Loop forever, or at least until quit // Print main menu printf(" Menu: " "1.\tNewton's Second Law of Motion " "2.\tVolume of a Cylinder " "3.\tCharacter Encoding " "4.\tGravity " "5.\tTangent " "6.\tTotal Parallel Resistance " "7.\tDistance Between Two Points " "8.\tGeneral Equation " "0.\tQuit " "Input Menu Item (0-8): "); int input; // menu selection scanf("%d", &input); if (input == 1) { // Menu item 1 double mass, acceleration; printf("Input Mass and Acceleration:"); scanf("%lf%lf", &mass, &acceleration); printf("Newton's Second Law: force = mass * acceleration : %lf * %lf : %.2lf ", mass, acceleration, calculate_newtons_2nd_law(mass, acceleration)); } else if (input == 2) { // Menu item 2 double radius, height; printf("Input Radius and Height:"); scanf("%lf%lf", &radius, &height); printf("Volume of a Cylinder: volume = PI * radius^2 * height : %lf * %lf^2 * %lf : %.2lf ", M_PI, radius, height, calculate_volume_cylinder(radius, height)); } else if (input == 3) { // Menu item 3 char character; printf("Input character: "); scanf(" %c", &character); printf("Character Encoding: 10 + ('character' + 'a') - 'A' : 10 + ('%c' + 'a') - 'A' : %c ", character, perform_character_encoding(character)); } else if (input == 4) { // Menu item 4 double mass1, mass2, distance; printf("Input the masses of the two objects, and their distance:"); scanf("%lf%lf%lf", &mass1, &mass2, &distance); printf("Force of Gravity: force = G * mass1 * mass2 / distance^2 : G * %lf * %lf / %lf^2 : %.2lf ", mass1, mass2, distance, calculate_gravity_force(mass1, mass2, distance)); } else if (input == 5) { // Menu item 5 double theta; printf("Input the angle theta: "); scanf("%lf", &theta); printf("Tangent : tan(theta) : tan(%lf) : %lf.2 ", theta, calculate_tangent(theta)); } else if (input == 6) { // Menu item 6 int r1, r2, r3; printf("Input the resistor strengths: "); scanf("%d%d%d", &r1, &r2, &r3); printf("Resistance : 1/((1 / r1) + (1 / r2) + (1 / r3)) : 1/((1 / %d) + (1 / %d) + (1 / %d)) : %.2lf ", r1, r2, r3, calculate_parallel_resistance(r1, r2, r3)); } else if (input == 7) { // Menu item 7 double x1, x2, y1, y2; printf("Input the two points, in order x1, x2, y1, y2. "); scanf("%lf%lf%lf%lf", &x1, &x2, &y1, &y2); printf("Distance : (x1 - x2)^2 + (y1 - y2)^2 : (%lf - %lf)^2 + (%lf - %lf)^2 : %.2lf ", x1, x2, y1, y2, calculate_distance_between_2pts(x1, x2, y1, y2)); } else if (input == 8) { // Menu item 8 double z, x; int a; printf("Input a, z and x: "); scanf("%d%lf%lf", &a, &z, &x); printf("General Equation: (7/5) * x / a + z - a / (a %% 2) + PI : (7/5) * %lf / %d + %lf - %d / (%d %% 2) + %lf : %.2lf ", x, a, z, a, a, M_PI, calculate_general_equation(a, z, x)); } else if (input == 0) { // Menu item 0 -- quit break; } else { // Error checking printf(" Error: Invalid Input. "); break; } } } ================================================================================= //equations.c #include #include "equations.h" /*Newton's Second Law*/ double calculate_newtons_2nd_law(double mass, double acceleration) { return mass * acceleration; } /*Volume of a Cylinder*/ double calculate_volume_cylinder(double radius, double height) { return (M_PI * pow(radius, 2)) * height; } /*Encode a character*/ char perform_character_encoding(char character) { return (char)(10 + (character - 'a') + 'A'); } /*Gravity*/ double calculate_gravity_force(double mass1, double mass2, double distance) { return (M_G * mass1 * mass2) / pow(distance, 2); } /*Tangent*/ double calculate_tangent(double theta) { return tan(theta); } /*Total Parallel Resistance*/ double calculate_parallel_resistance(int r1, int r2, int r3) { return 1 / ((1 / (double)r1) + (1 / (double)r2) + (1 / (double)r3)); } /*Distance between two points*/ double calculate_distance_between_2pts(double x1, double x2, double y1, double y2) { return sqrt(pow((x1 - x2), 2) + pow((y1 - y2), 2)); } /*General Equation*/ double calculate_general_equation(int a, double z, double x) { return ((double)7 / 5) * x / a + z - a / (a % 2) + M_PI; } ============================================================================= //equations.h #include #include #define M_PI 3.14159265358979323846 // PI #define M_G (6.67 * pow(10, -11)) // gravity constant /*Newton's Second Law*/ double calculate_newtons_2nd_law(double mass, double acceleration); /*Volume of a Cylinder*/ double calculate_volume_cylinder(double radius, double height); /*Encode a character*/ char perform_character_encoding(char character); /*Gravity*/ double calculate_gravity_force(double mass1, double mass2, double distance); /*Tangent*/ double calculate_tangent(double theta); /*Total Parallel Resistance*/ double calculate_parallel_resistance(int r1, int r2, int r3); /*Distance between two points*/ double calculate_distance_between_2pts(double x1, double x2, double y1, double y2); /*General Equation*/ double calculate_general_equation(int a, double;

image text in transcribed

Code Description (X LNK2001 unresolved external symbol_mainCRTStartup LNK1120 1 unresolved externals Error List Output Find Results 1 for Chemistry: Code Description (X LNK2001 unresolved external symbol_mainCRTStartup LNK1120 1 unresolved externals Error List Output Find Results 1 for Chemistry

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image_2

Step: 3

blur-text-image_3

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Concepts of Database Management

Authors: Philip J. Pratt, Joseph J. Adamski

7th edition

978-1111825911, 1111825912, 978-1133684374, 1133684378, 978-111182591

More Books

Students also viewed these Databases questions

Question

What are the requirements for a probability distribution?

Answered: 1 week ago

Question

3. What may be the goal of the team?

Answered: 1 week ago

Question

Is how things are said consistent with what is said?

Answered: 1 week ago