l just want to know how "GetYN" function is working like in "GetYN" function i declare that the "ch" does not equal to "Y and N" but when i am calling "GetYN" function l am declaring "GetYN()" equal to "Y".
but when i am calling "GetYN" function l am declaring "GetYN()" equal to "Y".
No you are comparing the return value from GetYN() (the character 'y' or 'n') to the value 'y'. In C++ there is a difference between the comparison operator== and the assignment operator=.
Welcome to the forum and thank you for using code tags.
In the function "GetYN" the do while continues until you press either 'y' or 'n' to cause the while loop to fail causing the the return value. You have the return value as an "int", but it would be better as a "char" since that is what "ch" is defined as.
In main the while condition is comparing the return value of the function to 'y'. Although it does work you are comparing an "int" to a constant "char". It would be nicer if they matched type of the variables.
As a note in the "Sum" function you could eliminate line 21 and have line 23 say return a + b; just as easily.