1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35
   | #include <iostream>
using namespace std;
//prototypes.
float fonction_surcharge(int val1=0, float val2=2.5);
float fonction_surcharge(float val1=4.1, int val2=2);
int fonction_surcharge(int val1=0);
float fonction_surcharge(float val1=2.5);
 
int main(){
    float f;
    int i;
    cout<<"La surcharge de la fonction fonction_surcharge"<<endl;
    fonction_surcharge(2,3.8); //test(i,f)
    fonction_surcharge(4.9,10);//test(f,i)
    fonction_surcharge(6);     //test(i)
    fonction_surcharge(10.4);     //test(f)
 
    system("pause");
}
float fonction_surcharge(int val1, float val2){
    cout<<"les 2 parametre de la fontion Test sont ("<<val1<<" , "<<val2<<")"<<endl;
 
}
float fonction_surcharge(float val1, int val2){
    cout<<"les 2 parametre de la fontion Test sont ("<<val1<<" , "<<val2<<")"<<endl;
 
}
int fonction_surcharge(int val1){
    cout<<"le parametre de la fontion Test est ("<<val1<<")"<<endl;
 
}
float fonction_surcharge(float val1){
    cout<<"le parametre de la fontion Test est ("<<val1<<")"<<endl;
 
} | 
Partager