Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- using namespace std;
- class Matrica {
- public:
- int a[10] = {};
- void set_all_zeros() {
- for (int i = 0; i < 10; ++i) {
- a[i] = 0;
- }
- }
- void increment_all() {
- for (int i = 0; i < 10; ++i) {
- a[i]++;
- }
- }
- void print() {
- for (int i = 0; i < 10; ++i) {
- cout << a[i] << ", ";
- }
- cout << endl;
- }
- };
- int main()
- {
- Matrica m;
- m.set_all_zeros();
- m.print();
- m.a[3] = 7;
- m.a[5] = 8;
- m.print();
- m.increment_all();
- m.increment_all();
- m.print();
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment