59.9k views
5 votes
Which line in the following program contains a call to the showDub function?

1 #include
2 using namespace std;
3
4 void showDub(int);
5
6 int main()
7 {
8 int x = 2;
9
10 showDub(x);
11 cout << x << endl;
12 return 0;
13 }
14
15 void showDub(int num)
16 {
17 cout << (num * 2) << endl;
18 }

A) 4
B) 6
C) 10
D) 15

1 Answer

3 votes

Final answer:

The call to the showDub function is found on line 10, where the function is executed with the integer variable x as its argument.

Step-by-step explanation:

The line in the program that contains a call to the showDub function is line 10. When a function is called, the program executes the function using the provided arguments. In this case, the function showDub is defined to take an integer as an argument, and it prints out twice the value of the number passed to it. Line 10 calls showDub by passing the variable x, which contains the value 2, therefore, executing the function and printing out the value 4.

User KcFnMi
by
9.3k points