This document covers following aspects of code evaluation for C++.
- 11
- 17
Every C++ application that doesn't use any Windows/Mac OS specific libraries can be built using the g++ compiler on a Linux/Unix environment. It is one of the most popular way to build C++ projects. So we would be leveraging g++ compiler
for the same.
We require that you name your Main
file as main.cpp
. The folder containing the main.cpp
will be considered as the root of your project and all the g++
commands to build out the final executable will be fired from there.
We want you to name your Main
file as main.cpp
. This is the file that will contain your main method.
This file should receive in the command line argument and parse the file passed in. Once the file is parsed and the application processes the commands, it should only print the output.
For e.g your main.cpp
file will look like this
int main(int argc, char *argv[]) {
/*Sample code to read from file passed as command line argument*/
string filename = argv[1];
ifstream inputFile(filename);
//Parse the file and call your code
//Print the output
inputFile.close();
return 0;
}
We then build and execute the solution by the following commands.
cd path/to/main.cpp
g++ <file1>.cpp <file2>.cpp ... <filen>.cpp main.cpp -o geektrust
./geektrust <absolute_path_to_input_file>
- Put all your unit-test files if any, under a folder named
test
. - Make your code OS agnostic, we will be building and running your code in Ubuntu Linux environment.