purbeechhetri
purbeechhetri purbeechhetri
  • 19-03-2021
  • Computers and Technology
contestada

what is output?
a include <iostreom.h>
void sub (float & x)
{ x + =2;
cout <<" \nx="<<x;
}
اے
void main ()
{ clrser ()
float x = 5.8
cout<<" \nx="<<x'
sob (x);
Cout <<"\nx="<<x
getch ();
}​

Respuesta :

tonb
tonb tonb
  • 19-03-2021

Answer:

x=5.8

x=7.8

x=7.8

Explanation:

I repaired the code somewhat (see below).

Since x is passed as a reference variable to the sub function, inside sub() the original variable is modified, so the changed value affects the variable declared in main().

If you would remove the & in sub, this wouldn't happen, and the variable in main would keep its value 5.8.

Ver imagen tonb
Answer Link

Otras preguntas

Help me please!!!!!!!​
A railway wagon of mass 100 kg is pulled with a force of 1000 N. what is its Acceleration ?​
Find the equation of the line that passes through (-3,1) and is parallel to y=1−2x.Leave your answer in the form y=mx+c
Identical products in fixed quantities can be produced in.... A . Job Production B . Batch Production C . Flow Production D . Lean Production
Why did the us choose to land in North Africa before continental Europe?
please help me on this ​
Explaining the SAS Similarity Theorem Criteria What information is necessary to prove two triangles are similar by the SAS similarity theorem?
Select the correct answer. What is the length of the indicated arc ? A. 2π B. 4π C. 9π D. 18π E. None of the above
Put these numbers in order of size, smallest to largest: 6, -2, 4, -3, 1 3​
PLEASE HELP! Punnett Square Practice Fill out each Punnett square based on the information in the problem. Then write in the phenotype for each genotype and the