I am learning C++ . Last class i had learned Function . Code :
double data_type(double x,double y)
int main ()
You will get the result 11.4 . But if you change data type :
If you change the red marked data type to integer or int , any of those three or all , result will be : 11
But if you change green marked data type to integer or int , both of them , result will be : 10
Are you getting the idea ? whenever you change the red marked data type to integer , it will show you the result having integer of result . That means , let result is 11.4 . It will show you 11 .
Whenever you change the green marked data type to integer , it will take the integer data of those given value . Above , I have given two value , x=5.8 & y=5.6 . When i change x’s green marked data type , it will take 5 out of 5.8 . And if i change y’s green marked data type , it will take 5 out of 5.6 . So the result will be : 10 .
If x’s green marked data type change to integer and all red marked data types are double or float then the result will be : 10.6
But if any red marked data types change to integer than that result will be : 10