updated filestructure and gitignore. uploading exam progress

This commit is contained in:
Christopher Sanden
2025-11-05 20:09:06 +01:00
parent 080cb0e79e
commit 17915675ab
86 changed files with 11835 additions and 0 deletions

View File

@@ -0,0 +1,31 @@
#include <iostream>
#include <fstream>
#include <sstream>
#include <string>
#include "ReadNames.h"
void readNamesFromFile(const std::string& aFilename, FNameRead aOnNameRead)
{
if (aFilename.empty()) return;
std::ifstream file(aFilename);
if (!file.is_open())
{
std::cerr << "Error opening file: " << aFilename << std::endl;
return;
}
std::string line;
while (std::getline(file, line))
{
std::istringstream iss(line);
std::string firstName, lastName;
if (iss >> firstName >> lastName)
{
if (aOnNameRead) // If the callback is set, call it
{
//If the function returns false, stop reading further
if (!aOnNameRead(firstName, lastName)) break;
}
}
}
file.close();
}