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;
static void printResult(const vector<Frame>& frames);
private:
static void printHeader();
static void printValue(const string& value);
static string parseValue(const vector<Frame>& frames);
};

View File

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