#include <stdio.h> #include <stdlib.h> int main() { char course_name[20]; int number_of_student; double courses_average_grade; int i; FILE *in; in=fopen("course_info.txt","r"); for(i=0;i<20;i++) { fscanf(in,"%s %d %lf",&course_name[i],&number_of_student,&courses_average_grade); printf("%s \t %d \t %.2f \n",course_name,number_of_student,courses_average_grade); } return 0; }
fscanf()
fscanf(in,"%s %d %lf",&course_name,&number_of_student,&courses_average_grade);
course_name
&course_name[i]
i
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)