I'm trying to create a function and link it to a header file and call the function to my main.cpp. This is the code from one function which I'll be calling in my main.cpp file. I'm trying to create a sort function that determines whether the integers in the file are sorted in order or not.
The file I'll be reading from can both be sorted and not sorted and output for the user the results, depending on the outcome of the file. Hopefully, I'm explaining in a clear! :S
#include <iostream>
#include <fstream>
#include <string>
#include <vector>
#include <algorithm>
#include "SortingFunc1.h"
int file_sort_checker() {
int nums;
std::string in_file_name;
std::ifstream resultat;
resultat.open("A");
resultat >> nums;
while (resultat.eof()) {
bool resultat = std::is_sorted(in_file_name.begin(), in_file_name.end());
if (resultat)
std::cout << "Filen är sorterad!" << nums << std::endl;
else {
std::cout << "Filen är inte sorterad!" << nums << std::endl;
}
resultat >> nums;
}
resultat.close();
}