Upload
hamza-bazhar
View
213
Download
0
Embed Size (px)
Citation preview
8/18/2019 Série 2 c++
1/2
Département d’Informatique
Faculté des Sciences, Université Ibn Zohr
Agadir
TD-2, C++, SMI5
Exercice 1 :
Donner le résultat d’exécution du programme ci-dessous sans faire appel à la machine (il faut que le format d’affichage soit respect́e ).
#include
using namespace std;
int x = -2;
int h(int & x){x = 2*x; return x;}
int g(int f){return x;}
int & f(int &x){x+=::x; return x;}
int main()
{
int x = 6;
f(::x) = h(x);cout
8/18/2019 Série 2 c++
2/2
#include
using namespace std;
void f (int x=10, float y=20);
void f (float m=30, int n=40);
main()
{char c=’A’;
int n=0;
float a=3.14;
f(n);
f(a);
f(c);
f(n,a);
f(a,n);
}
void f (int x, float y)
{
cout