Summary This assignment involves writing a computer program. The program will re
ID: 3434122 • Letter: S
Question
Summary This assignment involves writing a computer program. The program will read in a text file of paired data values. The program will then test the values for a correlation, following the structure of a Hypothesis test as set out in this module and based on information supplied from your knowledge of the correlation as a statistical test. Input Two parallel lists of values are written in a text file ?inputl.txt?, which takes the following format, with all numerical values separated by tab characters or return characters. N (an integer value) (N values of the first variable in a row) (N values of the second variable also in a row) Purpose of the program Your program should do the following: 1. Read the two lists of values from the text file.Explanation / Answer
#include <stdlib.h>
#include <stdio.h>
#include <math.h>
main()
{
FILE *input, *output;
char ch;
int N;
int count = 0;
int temp = 0;
input = fopen("input1.txt","r");
output = fopen("output1.txt","w");
fscanf(input, "%d",&N);
double first_var[N];
double second_var[N];
for(count = 1; count<N+1;count++)
{
fscanf(input, "%lf",&first_var[temp]);
printf("%lf ", first_var[temp]);
temp = temp+1;
}
temp = 0;
for(count = N+2; count<=2*N+1;count++)
{
fscanf(input, "%lf",&second_var[temp]);
printf("%lf ", second_var[temp]);
temp = temp+1;
}
for(temp = 0; temp < N; temp++) fprintf(output, "%lf %lf ", first_var[temp], second_var[temp]);
}
Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.