I apologize for my last post not following the rules. But here is my code that I have so far... along with the data to be read.
CODE
#include "stdio.h"
#include "math.h"
#define N 17
#define TUNNEL "tunnel.txt"
#define OUTPUT "output.txt"
int main(void)
{
/* Declare and initialize variables. */
int k=0, npts, angle_x;
double angle[N];
double lift[N];
double a, b, c;
double f(double x[ ], double y[ ]);
FILE *tunnel;
FILE *output;
tunnel=fopen("tunnel.txt","r");
output=fopen("output.txt","w");
if (tunnel == NULL)
printf("Error opening file");
else
{
fprintf(output,"Ryan Primiano, 2422240, Sec 2, Homework006\n");
fscanf(output,"%lf %lf",&angle[k],&lift[k]);
printf("Enter a flight-path angle: \n");
scanf("%i",&angle_x);
while ((fscanf(tunnel,"%lf %lf",&angle[k],&lift[k]))==2)
{
fprintf(output,"%.f %.3f\n",angle[k],lift[k]);
}
}
return 0;
}
tunnel.txt
CODE
-4 -0.182
-2 -0.056
0 0.097
2 0.238
4 0.421
6 0.479
8 0.654
10 0.792
12 0.924
14 1.035
15 1.076
16 1.103
17 1.120
18 1.121
19 1.121
20 1.099
21 1.059
Thank you for your time. Again I apologize for my post being formatted incorrectly.
This post has been edited by jjhaag: 31 Oct, 2007 - 10:47 AM