diff --git a/tp0/p1/main.cpp b/tp0/p1/main.cpp new file mode 100755 index 0000000..78b0e16 --- /dev/null +++ b/tp0/p1/main.cpp @@ -0,0 +1,37 @@ +#include + +using namespace std; +void remplitA(int tab[]); +void afficheA(int tab[]); + +int main() +{ + int a[10]; + int &refA5 = a[5]; + int *pointA7 = &a[7]; + remplitA(a); + //refA5 ++; + pointA7 = pointA7-2; + (*pointA7) ++; + afficheA(a); + return 0; +} + +void remplitA(int tab[]) +{ + for(int i=0 ; i<10 ; i++) + { + cout << "A [" << i << "] :"; + cin >> tab[i]; + }; +}; + +void afficheA(int tab[]) +{ + cout << "Valeurs de A :" << endl; + for(int i=0 ; i<10 ; i++) + { + cout << tab[i] << ", "; + } + cout << endl; +}; diff --git a/tp0/p1/p1.cbp b/tp0/p1/p1.cbp new file mode 100755 index 0000000..0fc5c62 --- /dev/null +++ b/tp0/p1/p1.cbp @@ -0,0 +1,42 @@ + + + + + +