#include #include //for setw and setprecision #include #include //for pow using namespace std; //Set of organ pipes spanning one octave. //Each pipe (except the first) is factor times as long as the previous one. int main() { const double factor {pow(2.0, 1.0/12.0)}; //twelfth root of 2 // cout << "Each pipe is " << fixed << setprecision(3) << factor << " times as long as the previous one.\n\n"; double length {100.0}; //length of each pipe for (int pipe {0}; pipe <= 12; ++pipe) { cout << setw(2) << pipe << " " << fixed << setprecision(3) << length << "\n"; length *= factor; //means length = length * factor; } return EXIT_SUCCESS; }