I don't understand why this isn't working.
*context* I am trying to open the examdat.txt file to read the file in my program, and then be able to write to the report.txt file. Right now I'm just trying to get the examdat.txt file to open.
I don't really know how to get it to open the exam.txt file, any help is appreciated.
*context* I am trying to open the examdat.txt file to read the file in my program, and then be able to write to the report.txt file. Right now I'm just trying to get the examdat.txt file to open.
#include <cstdlib> #include <iostream> // Grade a n-question (5-55) multiple choice exam //provide feedback for most frequently missed questions //Take data from file //examdat.txt //--------------------------------------------------------------------------- //first line of file contains # of questions on exam follwed by a space //then an n-character string of correct answers //-------------------------------------------------------------------------- //write a function fgetAnswers that inputs answers from an open input file. //Each of the lines that follow contain an interger student ID followed by a space then students answers // Function fgetAnswers con also be called to input a student's answers. //------------------------------------------------------------------------------- //Program is to produce an output file //Report.txt //Containing the answer key //and each student's ID //and each students score as a percentage using namespace std; int report[55]; int main(int argc, char *argv[]) { FILE *examdat; FILE *report; char quest[55]; examdat = fopen("examdat.txt","r"); report = fopen("report.txt","w"); fclose(examdat); fclose(report); system("PAUSE"); return EXIT_SUCCESS; }
I don't really know how to get it to open the exam.txt file, any help is appreciated.