0

Default Arguments' value

I wanna make a basic " calculator " programm in c++ that '+' be default value for operand if operand be empety and if it wasnt empety do other '-' '×' '÷' I will be grateful if you guide me.

8th Apr 2020, 8:11 AM
Booflor
Booflor - avatar
1 Antwort
+ 2
simply create a function for calculater with three arguments e.g void calc(int num1,num2,op='+') now if you pass it op another then + then it will do that operation,otherwise by default it will compute addition.
8th Apr 2020, 8:15 AM
Muhammad Faheem Nasir
Muhammad Faheem Nasir - avatar