-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathFil5.cpp
More file actions
84 lines (42 loc) · 1.03 KB
/
Fil5.cpp
File metadata and controls
84 lines (42 loc) · 1.03 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
#include <iostream>
#include <vector>
#include <algorithm>
#include <cmath>
#include <SFML/Graphics.hpp>
using namespace std;
class MathProblemSolver {
public:
MathProblemSolver() {}
void solve(vector<int> numbers) {
int answer = 0;
for (int i = 0; i < numbers.size(); i++) {
answer += numbers[i];
}
cout << "The answer is " << answer << endl;
}
void draw(sf::RenderWindow& window) {
sf::Text text("The answer is 0", font, 20);
text.setPosition(100, 100);
window.draw(text);
}
private:
sf::Font font;
};
int main() {
MathProblemSolver problemSolver;
vector<int> numbers = {1, 2, 3, 4, 5};
problemSolver.solve(numbers);
sf::RenderWindow window(sf::VideoMode(800, 600), "Math Problem Solver");
while (window.isOpen()) {
sf::Event event;
while (window.pollEvent(event)) {
if (event.type == sf::Event::Closed) {
window.close();
}
}
window.clear();
problemSolver.draw(window);
window.display();
}
return 0;
}