This project provides a simple example API for file operations and sorting functionality in C++. The project is organized with a clean directory structure and includes a Makefile for easy compilation.
- João F. G. de A. Oliveira ([email protected])
├── CMakeLists.txt
├── Makefile
├── README.md
├── include
│ ├── file_operations.h
│ └── sort.h
├── main.cpp
└── src
├── file_operations.cpp
└── sort.cpp
The FileOperations
class provides a method to read integers from a file.
- Method:
std::vector<long int> readFromFile(const std::string& filename);
void write_output_sorted_vector(const std::vector<long int>& vector, unsigned long int vector_size, const std::string& input_file_name, const std::string& selection_type);
The Sort
class provides a method to sort an array of integers.
- Method:
std::vector<long int> SelectionSort(std::vector<long int> &selection_vector, unsigned long int n);
std::vector<long int> InsertionSort(std::vector<long int> &insertion_vector, unsigned long int n);
To compile the project, you can use the provided Makefile
. Follow these steps:
-
Clone the Repository
git clone https://github.com/jf-gondim/example-cpp-api.git cd example-cpp-api/
-
Compile the Project
Run the following command in the root directory of the project:
make clean && make
This will compile the source files and generate an executable named
example-cpp-api
in the/bin
directory. -
Run the Executable
After compilation, you can run the executable:
./bin/example-cpp-api **data-files-to-be-sorted.in