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

Les médias Complétez les phrases avec des mots ou expressions appropriés. 1. Une _____ fidèle nous a écrit à propos de l'émission de la semaine dernière. 2. On
Which conclusion can be drawn from the passage that William Bardford said.
Water drains from a 60 gallon bath tub at a constant rate. It empties in 5 minutes. What is the rate? Help me pls
What were some engineering feats about the Incas?
We do honestly have a little more (1) ………………… time in summer than we do in spring. We have some weekend getaways planned over the summer. A couple of fun things
Quebec is trying to __________ Canada because they are concerned about preserving their culture. A. sue B. rescue C. break away from D. declare war against
Find the value of x in each parallelogram
HEY. YES, YOU. PLEASE HELP
Solve this equation by completing the square 2 −12 + 36 = 44. Show your work. No other method will be accepted
What is the difference between an organisms ecosystem and its habitat?