Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- using namespace std;
- int a[10] = {4,3,7,9,2,5,8};
- int m[3][3] {{1,2,3},{4,5,6},{7,8,9}};
- int maxim(int x[], int n)
- {
- int maxim = x[0];
- for(int i=1; i<n; i++)
- {
- if ( maxim < x[i] ) maxim = x[i];
- }
- return maxim;
- }
- void schimba(int &a, int &b)
- {
- cout << "Adresa lui a este: "<< &a << endl;
- int c=a;
- a=b;
- b=c;
- cout << a << " " << b << endl;
- }
- int maximm(int x[][3], int n, int m)
- {
- int maxim = x[0][0];
- for(int i=0; i<n; i++)
- for(int j=0; j<m; j++)
- {
- if ( maxim < x[i][j] ) maxim = x[i][j];
- }
- return maxim;
- }
- int main()
- {
- cout << &a[0]<<endl;
- cout << &a[1]<<endl;
- cout << &a[2]<<endl;
- cout << &a[3]<<endl;
- cout << &a[4]<<endl;
- cout << &a[5]<<endl;
- cout << a[0]<<endl;
- cout << a[1]<<endl;
- cout << a[2]<<endl;
- cout << a[3]<<endl;
- cout << a <<endl;
- cout << a+1 <<endl;
- cout << a+2 <<endl;
- cout << a+3 <<endl;
- cout << "maxim=" << maxim(a,7) <<endl;
- cout << a[0] << endl;
- int a1=3,b1=4;
- cout << "Adresa lui a este: "<< &a1 << endl;
- schimba(a1, b1);
- cout << a1 << " " << b1 << endl;
- cout << endl << endl;
- for(int i=0; i<3; i++)
- {
- for(int j=0; j<3; j++)
- cout << m[i][j]<< " ";
- cout << endl;
- }
- cout << m << endl;
- cout << m[0] << endl;
- cout << m[1] << endl;
- cout << m[2] << endl;
- cout << maximm(m,3,3) << endl;
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement