Skip to content

jf-gondim/example-cpp-api

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

6 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Example C++ API

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.

Authors

Project Structure

├── CMakeLists.txt
├── Makefile
├── README.md
├── include
│   ├── file_operations.h
│   └── sort.h
├── main.cpp
└── src
    ├── file_operations.cpp
    └── sort.cpp

Classes and Functionality

FileOperations

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);

Sort

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);

Compilation Instructions

To compile the project, you can use the provided Makefile. Follow these steps:

  1. Clone the Repository

    git clone https://github.com/jf-gondim/example-cpp-api.git
    cd example-cpp-api/
  2. 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.

  3. Run the Executable

    After compilation, you can run the executable:

    ./bin/example-cpp-api **data-files-to-be-sorted.in

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published