Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /**
- * @file Main.cpp
- * This my project, which takes user input and analyzes the given files
- * to find the maximum, minimum, and requested numbers in the file.
- *
- * @author Griffin Homan (griffh)
- * @date April 13th, 2015
- *
- * Virginia Tech Honor Code Pledge
- * On my honor:
- *
- * - I have not discussed the C++ language code in my program with
- * anyone other than my instructor or the teaching assistants
- * assigned to this course.
- * - I have not used C++ language code obtained from another student,
- * or any other unauthorized source, either modified or unmodified.
- * - If any C++ language code or documentation used in my program
- * was obtained from another source, such as a text book of coarse
- * notes, that has been clearly noted with a proper citation in
- * the comments of my program.
- * - I have not designed this program in such a way as to defeat or
- * interfere with the normal operation of the Web-Cat Server.
- *
- * Griffin Homan
- */
- #include <iostream> //calls the information needed
- #include <fstream>
- #include <string>
- using namespace std; //sets all unmarked commands to std::
- struct Student
- {
- string firstName;
- string lastName;
- string id;
- double gpa;
- };
- int readArray(ifstream& ifile, Student arr[]);
- int main()
- { // Declares the needed variables
- double i, min, max;
- string filename;
- ifstream ifile;
- Student arr[1000];
- cout << "Input File Name: ";//requesting the file name
- cin >> filename;
- ifile.open(filename.c_str());//opening the file
- if (!ifile)//checking if it opened or not
- {
- cout << endl << "That file does not exist!" << endl;//informing the user it did
- //not open and returning 1
- }
- cout << "Which number do you want to return? ";//requesting the desired number
- cin >> i;
- readArray(ifile, arr);
- return 0;
- }
- int readArray(ifstream& ifile, Student arr[])
- {
- int counter = 0;
- int num;
- ifile >> arr[1];
- while (ifile)
- {
- ifile >> num;
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement