Question

In: Computer Science

> gcc -c lab5.c -lm In file included from lab5.c:8: lab5.h:12: error: expected identifier or ‘(’...


> gcc -c lab5.c -lm
In file included from lab5.c:8:
lab5.h:12: error: expected identifier or ‘(’ before ‘{’ token
> In file included from lab5.c:8:
In: Command not found.
]> lab5.h:12: error: expected identifier or ‘(’ before ‘{’ token
Too many ('s.
> make: *** [lab5.o] Error 1
make:: Too many arguments.

#include #include #include #define IN_FILE "lab5.dat" #define OUT_FILE "lab5.txt" /* function prototype */ void find_two_radii (double a, double b, double c, double*radius_inside, double*radius_outside); { *s = 1/2*(a+b+c); *radius_inside = sqrt((s-a)(s-b)(s-c)); *radius_outside = 4*sqrt(s(s-a)(s-b)(s-c)); return 0;

Solutions

Expert Solution

Please find the answer below.
Please do comments in case of any issue. Also, don't forget to rate the question. Thank You So Much.

main.cpp

#include<iostream>
#include<cmath>
using namespace std;
#define IN_FILE "lab5.dat"
#define OUT_FILE "lab5.txt"

/* function prototype */
void find_two_radii (double a, double b, double c, double*radius_inside, double*radius_outside) {
   double s = 1.0/2*(a+b+c);
   *radius_inside = sqrt((s-a)*(s-b)*(s-c));
   *radius_outside = 4*sqrt(s*(s-a)*(s-b)*(s-c));
}

int main()
{
   double a=10;
   double b=12;
   double c=15;
   double ri,ro;
   find_two_radii(a,b,c,&ri,&ro);
   cout<<"Radius outside : "<<ro<<endl;
   cout<<"Radius inside : "<<ri<<endl;

   return 0;
}


Related Solutions

compile and link two c programs from cmd prompt: using command gcc program1.c program2.h -o main...
compile and link two c programs from cmd prompt: using command gcc program1.c program2.h -o main but getting error undefined reference to scheduleFCFS not sure how to correct issue.
Create a geoprocessing tool from the .py file included (script from this file included below). Use...
Create a geoprocessing tool from the .py file included (script from this file included below). Use any csv file you would like. I will work around that. This is for a programming for GIS class. We work with jupyter, idle, arcgis pro import os import arcpy from arcpy import env input_table = r"C:\Answers\January2018.CSV" output_fc = r"C:\Answers\crime.gdb\January2018_Crime" spRef = arcpy.SpatialReference("NAD 1983 StatePlane Missouri East FIPS 2401 (US Feet)") gdb_name = os.path.dirname(output_fc) fc_name = os.path.basename(output_fc) env.overwriteOutput = True print("Creating File GDB") arcpy.CreateFileGDB_management(os.path.dirname(gdb_name),...
Bananas are to be cooled from 28°C to 12°C at a rate of 1140 kg/h by...
Bananas are to be cooled from 28°C to 12°C at a rate of 1140 kg/h by a refrigerator that operates on a vapor-compression refrigeration cycle. The power input to the refrigerator is 9.8 kW. Determine (a) the rate of heat absorbed from the bananas, in kJ/h, and the COP, (b) the minimum power input to the refrigerator, and (c) the second-law efficiency and the exergy destruction for the cycle. The specific heat of bananas above freezing is 3.35 kJ/kg·°C.
This class should include .cpp file, .h file and driver.cpp (using the language c++)! Overview of...
This class should include .cpp file, .h file and driver.cpp (using the language c++)! Overview of complex Class The complex class presents the complex number X+Yi, where X and Y are real numbers and i^2 is -1. Typically, X is called a real part and Y is an imaginary part of the complex number. For instance, complex(4.0, 3.0) means 4.0+3.0i. The complex class you will design should have the following features. Constructor Only one constructor with default value for Real...
Would you make separated this code by one .h file and two .c file? **********code************* #include...
Would you make separated this code by one .h file and two .c file? **********code************* #include <stdlib.h> #include <stdbool.h> #include <stdio.h> #include<time.h> // Prints out the rules of the game of "craps". void print_game_rule(void) { printf("Rules of the game of CRAPS\n"); printf("--------------------------\n"); printf("A player rolls two dice.Each die has six faces.\n"); printf("These faces contain 1, 2, 3, 4, 5, and 6 spots.\n"); printf("After the dice have come to rest, the sum of the spots\n on the two upward faces is...
Recursion and Iteration in C++ Locate the TODO comments in the hw02.h file. These comments provide...
Recursion and Iteration in C++ Locate the TODO comments in the hw02.h file. These comments provide direction on what needs to be done. // hw02.h #ifndef CSC232_HW02_H #define CSC232_HW02_H // TODO: All pre-conditions must be validated using the assert function imported from the following library. // TODO: You are not allowed to use the pow function in this assignment! #include <cassert> #ifndef FALSE #define FALSE 0 #endif #ifndef TRUE #define TRUE !FALSE #endif #define USE_MAIN_INPUT_FILE FALSE #define USE_DEMO_INPUT_FILE FALSE #define...
IN C PROGRAMMING LINUX how to use makefile to include .a static library and .h file...
IN C PROGRAMMING LINUX how to use makefile to include .a static library and .h file from another directory in C? I have a header file myheader.h and a static library libmylib.a file in directory1. In directory2, I'm writing a program which uses them. Suppose I have main.c in directory2 which uses myheader.h and libmylib.a. How do I create a Makefile to compile and link them? LIBB = -L/../directory1/libmylib.a HEADER = -L/../directory1/myheader.h main: main.o gcc $(HEADER) $(LIBB) main.o: main.c gcc...
C Programming Debug -> error: expected expression before 'score' typedef enum LetterGrade {     A =...
C Programming Debug -> error: expected expression before 'score' typedef enum LetterGrade {     A = 4,     B = 3,     C = 2,     D = 1,     F = 0 } score; score getLetterGradeFromAverage(const double avg) {     if (avg >= 90)         return score::A;         // error here     else if (avg >= 80)         return score::B;        // error here     else if (avg >= 70)         return score::C;       // error here     else if (avg >=...
A solution is made by dissolving 0.0607 g of biphenyl (C 12 H 10 ) in...
A solution is made by dissolving 0.0607 g of biphenyl (C 12 H 10 ) in 350.0 mL of benzene (C 6 H 6 ) . If the vapor pressure of pure benzene is 24.4 kPa at 40.0 °C, then what will the vapor pressure of the solution be? (consider biphenyl to be nonvolatile)
1A) The XYZ Stock has an expected return of 12% and a standard deviation of 8%....
1A) The XYZ Stock has an expected return of 12% and a standard deviation of 8%. Assuming that returns are adequately explained by a normal distribution, what is the range of return you would expect to see 95% of the time? a. -12% to 36% b. 0% to 16% c. 4% to 20% d. -4% to 28% 1B) Which of the following statements correctly explains the coefficient of variation (CV)? (1) The CV is a relative measure of risk/return. (2)...
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT