In: Computer Science
> 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;
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;
}