This program contains seven syntax errors. Find and correct the errors.
// This program computes the time it takes to reach a
// destination, given the speed of a vehicle in miles per hour
// and the distance traveled in miles.
#include
using namespace std
int main ()
{
double distance; // distance traveled
double time; // hours to reach destination
double rate; // speed of the vehicle
cout << "Enter the distance traveled in miles => ";
cin << distance;
cout << endl;
cout << "Enter the speed of the vehicle (mph) => ";
cin << speed;
time = distance / rate
cout << endl;
cout << "The time it takes to reach the destination is ";
cout << endl << time << " hours.;
cout << endl;
return 0;
}
Assuming you made the corrections, what would be the output of the program given the following input data?
300
60
Error corrections are bold and underlined.
#include
using namespace std;
cin >> distance;
cin >> rate;
time = distance / rate;
cout << endl << time << " hours.";
Output (with interactive input shown and underlined):
Enter the distance traveled in miles => 300
Enter the speed of the vehicle (mph) => 60
The time it takes to reach the destination is
5 hours.
Computer Science & Information Technology
You might also like to view...
You can quickly add simple borders using the Borders button in the ____________________ group on the HOME tab.
Fill in the blank(s) with the appropriate word(s).
Computer Science & Information Technology
The absolute number is more important in sampling than the percentage of the:
A) sample size. B) standard deviation. C) population. D) average.
Computer Science & Information Technology
Which statement best suits the generalization of error messages?
A. More is best B. error messages the users see, however, should not be the error messages the developers see C. Everyone needs to see the Error messages D. Error messages help to the developers fix problems.
Computer Science & Information Technology
Define aggregation.
What will be an ideal response?
Computer Science & Information Technology