Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

Need this coded in C, no C++ functions can be used. Can include stdio.h, stdlib.

ID: 3685845 • Letter: N

Question

Need this coded in C, no C++ functions can be used. Can include stdio.h, stdlib.h, string.h, and ctype.h.

Need a program that in main prompts the user to input a txt file to be read.

Then i need a function SEPERATE from main that opens the file from main and stores up to 88 float numbers seperated by commas into an array. If any non numerical values are found in the file that line is to be flushed from the file and the program should continue reading the file but also print a msg saying which lines gave bad data. This array should be passed back to main using pointers

Explanation / Answer

#include <stdio.h>

#include <stdlib.h>

#include<string.h>

#include<ctype.h>

int main() {

float *ptr[];

char fname;

ptr = malloc(sizeof(*ptr));

printf(“ Enter file name:”);

gets(fname);

void read (fname);

ptr[] = *p;

printf(“Array Elements:”,ptr[]);

}

void read (char fname) {

fp = fopen(fname,”r”);

if(fp == NULL) {

printf(“ unable to read”);

exit(0);

} else {

float a[];

int m;

int n;

printf(“ Enter size of array:”);

scanf(“%d “,&n);

for(int i=0;i<=n;i++) {

m = integer.parseInt(fgetc(fp));

while(m!=EOF) {

if(!isdigit(m)) {

printf(“Data is not numeric”,m,_Line_);

remove(m);

exit(1); }

else {

a[i] =m;

}

}

float *p[] = join_float(arr,n);

return *p;

fclose(fp);

}

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote