Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- using namespace std;
- const int KOL = 3, RIJ = 3;
- void telOp(int*);
- int main() {
- int lijst[RIJ][KOL];
- for (int x = 0; x < 3; x++) {
- for (int y = 0; y < 3; y++) {
- lijst[x][y] = x * 3 + y;
- cout << "\t" << lijst[x][y];
- }cout << endl;
- }
- telOp(lijst[0]);
- system("pause");
- return 0;
- }void telOp(int* lijst) {
- int tel1 = 0, tel2 = 0, tel3 = 0;
- for (int x = 0; x < 9; x++)
- {
- if (x < 3) {
- tel1 += lijst[x];
- }
- else if ((x > 3)&&(x<6)) {
- tel2 += lijst[x];
- }
- else if ((x > 6) && (x<9)) {
- tel3 += lijst[x];
- }
- }
- cout << tel1 << endl;
- cout << tel2 << endl;
- cout << tel3 << endl;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement