1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27
|
#include <iostream>
#include <iomanip>
#include <cmath>
#include <string>
using namespace std;
int main()
{
string notes[13] =
{ "A", "A#", "B", "C", "C#", "D", "D#", "E", "F", "F#", "G", "G#", "A" };
double ratio = pow(2.0, 1.0/12.0);
cout << fixed;
cout << setprecision(12);
cout << "ratio: " << ratio << endl << endl;
double a = 220;
cout << setprecision(4);
for (int i=0; i<=12; i++)
{
cout << left << setw(3) << notes[i] << right << a * pow(ratio, i) << endl;
}
return 0;
}
|