after error I made this... then I did this... what do I do? here is the rest of
ID: 3590460 • Letter: A
Question
after error I made this...
then I did this...
what do I do?
here is the rest of my code
header file
my main.c file
this is for Code:::Blocks. I'm learning how to use C programming. would like some help for getting my code to work. Thanks. Also this is the book we are using, where the code is from. I needed to make a rand_float.c file and a header file which I am confused about as you can see
Explanation / Answer
//Please see the working code below:
#include<stdio.h>
#include<stdlib.h>
#include<math.h>
#include<conio.h>
double rand_float(double a , double b,double num1,double num2,double num3);
int main()
{
// the input must be integers separated by commas
unsigned int seed;
int n,k;
double component_reliability,a_series, a_parallel,
series_success=0, parallel_success=0,
num1,num2,num3;
double rand_float(double a, double b);
printf("Enter individual Component reliabilit: ");
scanf("%lf",&component_reliability);
printf("Enter number of trials: ");
scanf("%i",&n);
printf("Enter unsigned integer seed: ");
scanf("%u",&seed);
srand(seed);
printf(" ");
/*Compute Analytical reliabilities */
a_series=pow(component_reliability,3);
a_parallel=3*component_reliability
-3*pow(component_reliability,2)
+ pow(component_reliability,3);
/*Print results. */
printf("Analytical Reliability ");
printf("Series:%.3f Parallel: %.3f ",
a_series,a_parallel);
printf("Simulation Reliability, %i trials ",n);
printf("Series:%.3f Parallel: %.3f ",
(double)a_series/n,(double)a_parallel/n);
getch();
return 0;
}
double rand_float(double a , double b)
{
return ((double)rand()/RAND_MAX)*(b-a)+a;
}
Related Questions
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.