This time we are introducing you to a new yet easier way of code submission.
In any of the questions, you do not need to use any kind of input(cin, getline,...) or output(cout, write,..) statements.
Just follow the guidelines provided in each question before proceeding towards submission.
Each question comes up with a requested file, You just need to write code within the function body of the requested file provided.
Do not change the name of the file.
Do not change the function definition of the requested file.
Do not write main function within the requested file.
Do not take input or print any kind of output.
Link 1: Graded Assignment 3 questions
Link 2: Adding Security Exceptions Configuration To Your Browser For Moodle
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.