#include #include #include #include #include #include #include // Write classes Data, File_Table and Sinus_Function here (or in separate files if you prefer)! // Hint: // You may calculate the largest x-coordinate with a loop or however you like, // but if you followed TDDI82 you may use knowledge you gained after TDIU20. // If you have // std::vector> v; // you can use // std::max_element(begin(v), end(v))->first // to find the element with largest first-value. void plot(Data const& data, char mark = '+', char fill = ' ') { std::cout << "=== Plotting " << data.get_caption() << " ===" << std::endl; for (int i {0}; i <= data.size(); ++i) { int value { data.get_point(i) }; std::cout << std::setfill(fill) << std::setw(value) << mark << std::endl; } } int main() { File_Table pd {"Measurements", "data.txt"}; plot(pd, '|', '#'); Sinus_Function sd {"Sinus", -5, 13}; plot(sd); /* Only for the extra assignment Plot barplot{'|', '#'}; barplot << pd; barplot << sd; Plot mathplot{'+', ' '}; mathplot << pd; mathplot << sd; */ }