I wrote the following code to create a table that displays meters and converts it to feet. However, my setw() in my for loop isnt spacing out properly like outside the loop. Any help would be appreciated! :)
#include <iostream>
#include <iomanip>
using namespace std;
int main() {
int meters;
double feet;
std::cout << fixed;
std::cout << left;
std::cout << "Meters " << setw(10) << "Feet" <<endl;
for (int meters = 1; meters < 16; meters++) // for loop choosing how large you want the table to be by changing the middle condition integer
{
feet = meters * 3.280;
std::cout << meters << setw(10) << setprecision(3) << feet << endl;
}
}