{[ promptMessage ]}

Bookmark it

{[ promptMessage ]}


CS215Program2(1o5) - CS215Program2.cpp Author Completion...

Info iconThis preview shows pages 1–3. Sign up to view the full content.

View Full Document Right Arrow Icon
Sheet1 Page 1 // CS215Program2.cpp // // Author: // Completion Date: // // Interface to Windows display // Three functions in this source file are called by // the Windows code (see prologs below): //getStudent - first time called, //open student data file, read into //an array of student objects. Each time called, //display requested student data // //updateStudent - update student data with new //grade data // //endProgram - when user exits display, write //student data to file savestudents.txt // #include "stdafx.h"// needed for Windows display #include <iostream> #include <string> // string class #include <fstream> using namespace std #include "student.h" // Constant characters of menu options const char LABCHAR = 'L' const char PROGRAMCHAR = 'P' const char MIDTERMCHAR = 'M' const char FINALCHAR = 'F' const int MAX = 100 student students[MAX] // Global student variables used by multiple functions bool validStudent int studentIndex string studentNumber // first time getStudent called, read data into array of objects bool firstTime = true // Prototype for displayStudentData function string displayStudentData(int studentIndex) // // getStudent // // Interface to Windows display for student data
Background image of page 1

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full Document Right Arrow Icon
Sheet1 Page 2 // when user enters student number to be displayed // // Precondition: //A file called students.txt exists and contains good //data. The first time this function is called //(controlled by firstTime global variable), the file data //is read into an array of student objects. //Parameters received from the caller: //studentNumFromScreen: the student number entered on the screen // Postcondition: //Returned to caller - returnMessage: //A response to the Windows display caller is returned //with the requested student data. A global //flag (validStudent) is set. The index //of the object in the student object array of objects is //put in the global variable studentIndex //Error messages are returned if the students.txt file //cannot be opened, or the requested student number //is not found. // // Implementation: //An array of student objects is used to hold the //student data. // The array size is 100. A maximum of 100 students // in the input file is assumed.
Background image of page 2
Image of page 3
This is the end of the preview. Sign up to access the rest of the document.

{[ snackBarMessage ]}

Page1 / 14

CS215Program2(1o5) - CS215Program2.cpp Author Completion...

This preview shows document pages 1 - 3. Sign up to view the full document.

View Full Document Right Arrow Icon bookmark
Ask a homework question - tutors are online