GRADED ASSIGNMENT 4   Due Date:- Tuesday, 23 October 2018, 8:00 PM


KEY NOTES

  1. This time we are introducing you to FILE-READ and FILE-WRITE operations.

  2. In any of the questions, you do not need to use any kind of input(cin, getline,...) or output(cout, write,..) statements.

  3. Just follow the guidelines provided in each question before proceeding towards submission.

  4. Each question comes up with a requested file, You just need to write code within the function body of the requested file provided.

  5. Maximum Grade for GA 4 Qn 1 and Qn 2 is 10. Maximum Grade for GA 4 Qn 3 is 20.


~ WARNINGS ~


Link 1:  vector of vector

Link 2:  Graded Assignment 4 questions

Link 3:   Adding Security Exceptions Configuration To Your Browser For Moodle


ADDITIONAL INFORMATION

You might be wondering how your code will run without a main method. So here is the explanation.

We have a created a main.cpp file in moodle which contains the main method. This main.cpp file is hidden from the students. Our main.cpp file calls the function in the requested file. After we receive the required arguments we have a checker function which checks if the students answers are correct or not.

Here is a sample example for your understanding purpose only.

Our main.cpp contains code something like this...

#include "iostream"

using namespace std;

extern int uniqueInteger(vector<int> V); // it defines that uniqueInteger function is in an external file

bool check(int studentAnswer, int correctAnswer){
if(studentAnswer==correctAnswer) return true;
return false;
}

int main(){

vector<int> V {1,2,3,3,2};
int studentAnswer = uniqueInteger(V); // Call to the function unique Integer that is inside the requested file
int correctAnswer = 1;
bool correct = check(studentAnswer, correctAnswer); // Check if student answer is correct
int grade=0;
if(correct) grade=10;
else grade=0;

}

Now say the requested file name is Ga3Qn3.cpp

We compile your code using the command 'g++ main.cpp Ga3Qn3.cpp' and then run it using './a.out'

This is just for a simple understanding on how the things work. In practice we have additional scripts running to handle the grading and number of test cases.