Skip to content

Commit

Permalink
fixed newlines and errors
Browse files Browse the repository at this point in the history
  • Loading branch information
ViktorPopp committed Aug 13, 2024
1 parent 14ff160 commit f9d65d4
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions Source/TodoList.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ TodoList::TodoList(const std::string& filename) : filename(filename) {
}

void TodoList::LoadTodos() {
std::cout << "Loading todos from file: " << filename << std::endl;
std::cout << "Loading todos from file: " << filename << "\n";
std::ifstream file(filename);
if (file.is_open()) {
Todo todo;
Expand All @@ -15,15 +15,15 @@ void TodoList::LoadTodos() {
file.close();
}
else {
std::cout << "Failed to open file" << std::endl;
std::cout << "Failed to open file. If the file not exists it will be created and you should ignore this\n";
}
}

void TodoList::SaveTodos() {
std::ofstream file(filename);
if (file.is_open()) {
for (const auto& todo : todos) {
file << todo.title << " " << todo.description << " " << todo.isDone << std::endl;
file << todo.title << " " << todo.description << " " << todo.isDone << "\n";
}
file.close();
}
Expand Down Expand Up @@ -51,6 +51,6 @@ void TodoList::CheckTodo(int index) {

void TodoList::ListTodos() {
for (size_t i = 0; i < todos.size(); ++i) {
std::cout << "[" << (todos[i].isDone ? "x" : " ") << "] " << todos[i].title << ": " << todos[i].description << std::endl;
std::cout << "[" << (todos[i].isDone ? "x" : " ") << "] " << todos[i].title << ": " << todos[i].description << "\n";
}
}

0 comments on commit f9d65d4

Please sign in to comment.