Cleaned up main.cpp

This commit is contained in:
Rasmus Rasmussen 2025-03-27 18:09:44 +01:00
parent efc1b264b8
commit 35cd28b6be
3 changed files with 10 additions and 9 deletions

View File

@ -13,8 +13,11 @@ class PrintFrames {
~PrintFrames() = default; ~PrintFrames() = default;
static void printResult(const vector<Frame>& frames);
private:
static void printHeader(); static void printHeader();
static void printValue(const string& value);
static string parseValue(const vector<Frame>& frames); static string parseValue(const vector<Frame>& frames);
}; };

View File

@ -2,12 +2,13 @@
#include <iostream> #include <iostream>
#include <sstream> #include <sstream>
void PrintFrames::printHeader() { void PrintFrames::printResult(const vector<Frame>& frames) {
cout << "| f1 | f2 | f3 | f4 | f5 | f6 | f7 | f8 | f9 | f10 |" << endl; printHeader();
cout << parseValue(frames);
} }
void PrintFrames::printValue(const string& value) { void PrintFrames::printHeader() {
cout << value; cout << "| f1 | f2 | f3 | f4 | f5 | f6 | f7 | f8 | f9 | f10 |" << endl;
} }
string PrintFrames::parseValue(const vector<Frame>& frames) { string PrintFrames::parseValue(const vector<Frame>& frames) {

View File

@ -27,10 +27,7 @@ int main(int argc, char *argv[]) {
vector<Frame> frames = NumberUtils::createFrames(rolls); vector<Frame> frames = NumberUtils::createFrames(rolls);
string values = PrintFrames::parseValue(frames); PrintFrames::printResult(frames);
PrintFrames::printHeader();
PrintFrames::printValue(values);
int score = ScoreCalculator::getScore(frames); int score = ScoreCalculator::getScore(frames);
cout << "Score: " << score << endl; cout << "Score: " << score << endl;