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 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72
|
#include <string>
#include <iostream>
#include <sstream>
using namespace std;
string chromatic_scale[12] = {"C","C#","D","D#","E","F","F#","G","G#","A","A#","B"};
string* ionian_mode[7];
string UI = "";
void get_UI()
{
cout<<"choose a key"<<endl;
for(int i = 0; i < 12; i++)
cout<<chromatic_scale[i]<<", ";
cout<<endl;
getline(cin, UI);
}
void output_scale()
{
for(int i = 0; i < 7; i++)
cout<< *ionian_mode[i]<< ", ";
cout<<endl;
}
void whole_step(int* i)
{
*i =+ 2;
if(*i >= 12) *i =- 12;
}
void half_step(int* i)
{
*i =+ 1;
if(*i >= 12) *i =- 12;
}
void assign_ionian_mode()
{
int i = 0;
while(UI != chromatic_scale[i])
{
i++;
};
ionian_mode[0] = &chromatic_scale[i];
whole_step(&i);
ionian_mode[1] = &chromatic_scale[i];
whole_step(&i);
ionian_mode[2] = &chromatic_scale[i];
half_step(&i);
ionian_mode[3] = &chromatic_scale[i];
whole_step(&i);
ionian_mode[4] = &chromatic_scale[i];
whole_step(&i);
ionian_mode[5] = &chromatic_scale[i];
whole_step(&i);
ionian_mode[6] = &chromatic_scale[i];
}
int main(int argc, char* argv[])
{
get_UI();
assign_ionian_mode();
output_scale();
return 0;
}
|