Write a program that prints out a student grade report. There is a file, classes
ID: 3839231 • Letter: W
Question
Write a program that prints out a student grade report. There is a file, classes.txt, that contains the names of all classes taught at a college, such as classes.txt 1 CSC1 2 CSC2 3 CSC46 4 CSC151 5 MTH121 6 ... For each class, there is a file with student numbers and grades: csc2.txt
1 11234 A-
2 12547 B
3 16753 B+
4 21886 C
5 ...
Write a program that asks for a student ID and prints out a grade report for that student, by searching all class files.
Here is a sample report
Student ID 16753
CSC2 B+
MTH121 C+
CHN1 A
PHY50 A
Explanation / Answer
Answer:
here we have 2 text files that is classes.txt,cse2.txt.
#include<stdio.h>
#include<stdlib.h>
int main()
{
FILE *f;
FILE *f1;
char c,i;
f=open("classes.txt","r");
f1=open("cse2.txt");
while((c=fgetc(f)!=EOF)
{
printf("%c",c);
}
if((i=fgeti(f1))!=EOF)
{
printf("%c",i);
}
fclose(f1)
fclose(f);
return 0;
}
2 Answer:
#include<iostrem>
#include<fstream>
using namespace std;
class grades
int main()
{
char c;
FILE *f;
f=open("id.txt","r");
printf("enter the id ");
while(c==id.txt!=EOF)
{
printf("%c" ,c);
}
fclose(f);
return 0;
}
Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.