Write a main program that prompts the user for two integer numbers (num1 and num2). Then, the main program calls the function doIt with num1 and num2 as parameters. The main program will finally print the content of num1 and num2 on the screen.
what im confused
well i have this question and i can't figure it out
Let’s consider the following function: void doIt(int& a, int b) // Please not the & symbol { a = a * 2; b = b * 2 } Write a main program that prompts the user for two integer numbers (num1 and num2). Then, the main program calls the function doIt with num1 and num2 as parameters. The main program will finally print the content of num1 and num2 on the screen.
I use the program language visual basic.Net What will after ''//'' symbol, it is the annotation for you to easily understand what the program is doing at a particular line. Dim num1, num2 as integer // the program shall recognise those variables as whole numbers num1=-1 num2=-2 // I set those values into a rogue value Number: InputBox(''Input first number''_''num1'') Number: InputBox(''Input second number''_''num2'') FUNCTION Dolt (num1, num2 as integer) as integer // The function dolt is called to take parameters num1 and num2 which are as integer and the output of the function has to be in integer form. MsgBox: ('' The values input are'' & ''num1'' & ''num2''_ ''Answer'')// to output num1 and num2 ENDFUNCTION
``` void doIt(int a, int b) { std::cout <<a << " + " << b; } int main() { int num1, num2; std::cin >> num1 >> num2; doIt(num1,num2); } ``` doubt this works but it's a half step above pseudocode
Join our real-time social learning platform and learn together with your friends!