- 01
- 02
- 03
- 04
- 05
- 06
- 07
- 08
- 09
- 10
- 11
- 12
- 13
- 14
- 15
- 16
- 17
- 18
- 19
- 20
- 21
- 22
- 23
- 24
- 25
- 26
- 27
- 28
- 29
- 30
- 31
- 32
- 33
- 34
- 35
- 36
- 37
#include <iostream>
#include <string>
using namespace std;
int main()
{
const int hz_limit = 20000;
string str;
string str_mass[] = {"a", "b", "ais", "h", "ces", "c", "his", "cis", "des",
"d", "dis", "es", "e", "fes", "f", "eis", "fis", "ges", "g", "gis", "as"};
begin:
while (cin>>str)
{
for (size_t ix = 0; ix != str.size(); ++ix)
{
str[ix] = tolower(str[ix]);
}
size_t f = 0;
for (size_t ix = 0; ix != 21; ++ix)
{
if(str == str_mass[ix])
{
f = ix;
}
}
if (str != str_mass[f])
{
goto begin;
}
double mass[] = {27.500, 29.135, 29.135, 30.868, 30.868, 32.703, 32.703, 34.648, 34.648,
36.708, 38.891, 38.891, 41.203, 41.203, 43.654, 43.654, 46.249, 46.249, 48.999, 51.913, 51.913};
for (; mass[f] < hz_limit; mass[f] *= 2)
{
cout<<mass[f]<<" Hz"<<endl;
}
}
return 0;
}
Моя первая прога. Выводит частоты на которых находится введенная нота...