Pagina de inicio
/
Tecnología
/
What will the following code do? var cost=readFloat'' Enter cost:"): println(cost); Ask the user to input a cost and display it as a float Read an integer and display it Display "Enter cost:" without accepting input Cause a syntax error

Problemas

What will the following code do?
var cost=readFloat'' Enter
cost:"):
println(cost);
Ask the user to input a cost and
display it as a float
Read an integer and display it
Display "Enter cost:" without
accepting input
Cause a syntax error

What will the following code do? var cost=readFloat'' Enter cost:"): println(cost); Ask the user to input a cost and display it as a float Read an integer and display it Display "Enter cost:" without accepting input Cause a syntax error

Solución

avatar
Ivánprofessionell · Tutor durante 6 años
expert verifiedVerificación de expertos
4.6 (288 votos)

Responder

The code will cause a syntax error. The correct syntax for reading a float input in Pascal is `readln` instead of `readFloat`. Therefore, the line `cost=readFloat''\quad Enter` is incorrect and will result in a syntax error.
Haz clic para calificar: