i have this assignment due tommorow ive tryed it but it seems tuffer than what it should. anyone have any ideas?
Write a function stage 1() that reads one of Tommy’s data files into a suitably declared and named
data structure. You should assume that there will be at most 100 rows in any given data file.
After reading the data file, your function should report (yes, the functions developed as part of this
project will have scanf and printf calls in them) the total number of towers in this model, and the sum
of their transmit powers, in Watts. Sample output for all stages is given below.
Be sure to make appropriate use of the #define and typedef facilities. Think carefully about how
your function should interface with the main program, and choose an appropriate set of parameters and
appropriate return type/value.
i still have another 5 stages but they all depend on this .
this is wat ive done:
[/* stage 1 */
#include<stdio.h>
/* size of array */
#define ROWS 100
#define DIST 1000
/* stage 1 function is meant to read values inputed and clculate the power and number of towers. */
double stage_1(double[],double[],double);
int
main(int argc, char **argv) {
return 0;
}
double
stage_1(double X[], double Y[] , double *powert ) {
int row, next;
double distx, disty, *powert;
/*initalise varibles */
distx=0.0;
disty=0.0;
pt=0.0;
row=0;
printf("Enter Distance in the x direction and y direction (max DIST %d)\n"
" of each tower : ", DIST);
scanf("%lf %lf %lf ", &distx,disty, pt);
/*now a number has been put in now calculate the number of towers*/
if (n == ROWS){
n = next/3;
n += 1;
}
return n;
printf("Data file describes %lf towers, of total capacity Watts \n", n);
} ]