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 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129
|
#include <iostream>
int main()
{
using namespace std;
bool mainrepeat = true;
while (mainrepeat == true){ //<--- there is a bracket
char Chords[2][7] = {{'a', 'b', 'c', 'd', 'e', 'f', 'g'}, {'A', 'B', 'C', 'D', 'E', 'F', 'G'}};
char chord, repeatc;
int i, j;
bool repeatb = true;
while (repeatb == true){ //<--- there is a bracket
cout << "Please enter a chord letter...\n> ";
cin >> chord;
for (i = 0; i <= 7; i++)
{
if (chord == Chords[0][i] || chord == Chords[1][i])
{
break;
}
if (i == 7)
{
cout << "I don't think that's a chord...\nTry again\n> ";
cin >> chord;
i = 0;
continue;
}
}
cout << "\nThe chord you entered was the " << Chords[1][i] << " chord\n";
cout << "\nIs this correct? <y> or <n>\n> ";
cin >> repeatc;
if (repeatc == 'n')
repeatb = true;
else if (repeatc == 'y')
repeatb = false;
} //<--- chord confirmation while loop ending bracket
cout << endl;
switch (i)
{
case 0: //A
cout << "e-----0-----\n";
cout << "B-----2-----\n";
cout << "G-----2-----\n";
cout << "D-----2-----\n";
cout << "A-----0-----\n";
cout << "E-----------\n";
break;
case 1: //B
cout << "e-----------\n";
cout << "B-----4-----\n";
cout << "G-----4-----\n";
cout << "D-----4-----\n";
cout << "A-----2-----\n";
cout << "E-----------\n";
break;
case 2: //C
cout << "e-----0-----\n";
cout << "B-----1-----\n";
cout << "G-----0-----\n";
cout << "D-----2-----\n";
cout << "A-----3-----\n";
cout << "E-----------\n";
break;
case 3: //D
cout << "e-----2-----\n";
cout << "B-----3-----\n";
cout << "G-----2-----\n";
cout << "D-----0-----\n";
cout << "A-----------\n";
cout << "E-----------\n";
break;
case 4: //E
cout << "e-----0-----\n";
cout << "B-----0-----\n";
cout << "G-----1-----\n";
cout << "D-----2-----\n";
cout << "A-----2-----\n";
cout << "E-----0-----\n";
break;
case 5: //F
cout << "e-----1-----\n";
cout << "B-----1-----\n";
cout << "G-----2-----\n";
cout << "D-----3-----\n";
cout << "A-----------\n";
cout << "E-----------\n";
break;
case 6: //G
cout << "e-----3-----\n";
cout << "B-----0-----\n";
cout << "G-----0-----\n";
cout << "D-----0-----\n";
cout << "A-----2-----\n";
cout << "E-----3-----\n";
break;
}
cout << "\nAre you finished? <y> or <n>\n> ";
cin >> repeatc;
if (repeatc == 'n')
mainrepeat = true;
else if (repeatc == 'y')
mainrepeat = false;
} //<--- main while loop ending bracket
cout << "\nPress ENTER to exit\n";
cin.get();
cin.get();
return 0;
}
|