Question: Question 2 :(cin within a loop) Write and run a C++ program that accepts 10 values of gallons, one at a time, and converts each

Question 2 :(cin within a loop) Write and run a C++ program that accepts 10 values of gallons, one at a time, and converts each value entered to its liter equivalent before the next value is requested. Use a for loop in your program. Use the fact that 1 gallon = 3.785 liters.
Program
#include
using namespace std;
int main() {
double factor=3.785;
for(int i=0;i
double k;
cout
cin>>k;
k=k*factor;
cout
k=0;
}
return 0;
}
3. (Interactive loop control) Modify the program written for Exercise 2 to initially request the number of data items to be entered and converted
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
