Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <cstdlib>
- #include <iostream>
- using namespace std;
- int wpisz_elementy(int A[3], int B[3])
- {
- cout << "Podaj elementy macierzy A: " << endl;
- for (int i = 0; i<3; i++)
- {
- cout << "Podaj element " << i + 1 << endl;
- cin >> A[i];
- }
- cout << "Podaj elementy macierzy B: " << endl;
- for (int i = 0; i<3; i++)
- {
- cout << "Podaj element " << i + 1 << endl;
- cin >> B[i];
- }
- return 0;
- }
- int dodaj(int A[3], int B[3], int C[3])
- {
- for (int i = 0; i<3; i++)
- {
- C[i] = A[i] + B[i];
- }
- return C[3];
- }
- int wypisz(int C[3])
- {
- cout << "Macierz A + B = " << endl;
- for (int i = 0; i<3; i++)
- {
- cout << C[i] << ", ";
- cout << endl;
- }
- return 0;
- }
- int main()
- {
- int A[3]; //macierz A
- int B[3]; //macierz B
- int C[3]; //macierz wynikowa C
- wpisz_elementy(A, B);
- dodaj(A, B, C);
- wypisz(C);
- system("PAUSE");
- return EXIT_SUCCESS;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement