Friday, July 31, 2009

C ++ help please!!?

3. For the following program write the output:


int function1 (int a, int%26amp; b, char ch = 'I')


{


cout%26lt;%26lt;a-b%26lt;%26lt;" "%26lt;%26lt;ch%26lt;%26lt;endl;


b = a - b;


return b;


}





double function1 (double x, int b, char ch = 'I')


{


cout%26lt;%26lt;x+b%26lt;%26lt;" "%26lt;%26lt;ch%26lt;%26lt;endl;


return x + b;


}





double function1 (double%26amp; x, double y, char ch = 'D')


{


cout%26lt;%26lt;x+y%26lt;%26lt;" "%26lt;%26lt;ch%26lt;%26lt;endl;


x = x + y;


return x;


}





double function1 (int a, double x, char ch = 'D')


{


cout%26lt;%26lt;x+a%26lt;%26lt;" "%26lt;%26lt;ch%26lt;%26lt;endl;


return x + a;


}





int main()


{


double db1 = 1.5, db2 = 2.5;


int in1 = 3, in2 = 7;





in1 = function1(in1, in2, 'J'); //1. ________


cout %26lt;%26lt;in1%26lt;%26lt;endl; //2. ________


cout %26lt;%26lt;in2%26lt;%26lt;endl; //3. ________


db2 = function1(db1, in1); //4. ________


cout%26lt;%26lt;db2%26lt;%26lt;endl; //5. ________


function1(1, 1.5); //6. ________


in2 = function1(db2, 1.5, 'K'); //7. ________


}








Can you please help me write the outputs? Thanks

C ++ help please!!?
This is your output:





-4 J


-4


-4


-2.5 I


-2.5


2.5 D


-1 K
Reply:-4J


-4


7


4.5I


4.5


2.5I


error or some compiler can give 3K

bottle palm

No comments:

Post a Comment