How to get results inside function?? | Sololearn: Learn to code for FREE!
Novo curso! Todo programador deveria aprender IA generativa!
Experimente uma aula grƔtis
0

How to get results inside function??

How can I get return result inside function??

19th Jul 2021, 3:03 PM
Rao Muzaffar
Rao Muzaffar - avatar
4 Respostas
+ 1
You can define your function as a float or a double returning function, then return that data type with: return result; inside the function. If you want to print it out, you can store the return value from the function into a variable and use cout: float/double stored_value = function (inch, cm); cout << stored_value ; or just use: cout << function(inch, cm); Printing it inside the function is the same, only inside the function instead. Just do: cout << result; in the body of the function. NOTE: this isn't actual working code, just a generic idea of what you should be looking for.
19th Jul 2021, 3:49 PM
BootInk
BootInk - avatar
0
I dont understand what you are asking. Can yoh give an example of what you are trying to do?
19th Jul 2021, 3:05 PM
Brain & Bones
Brain & Bones - avatar
0
Some one gave me this problem I know how to convert inch to cm but there is a condition in last so I can't understand that condition??2. Write a program which take input from user to convert the inches to centimeter using a function. The results must be printed inside the function.
19th Jul 2021, 3:07 PM
Rao Muzaffar
Rao Muzaffar - avatar
0
Okay
19th Jul 2021, 3:20 PM
Rao Muzaffar
Rao Muzaffar - avatar