#include #include using namespace std; int main() { const string sscales[] { "C", "G", "D", "A", "E", "B", "F#" }; const string fscales[] { "C", "F", "Bb", "Eb", "Ab", "Db", "Gb" }; int sharps {0}; cout << "How many sharps does your scale have?\n"; cin >> sharps; if (!cin){ cerr << "Sorry that is not an acceptable number.\nTry again.\n"; return EXIT_FAILURE; } if (sharps > 6) { cout << "Not a possible number of sharps in a scale.\n"; return EXIT_FAILURE; } else if (sharps > 0) { cout << "Your scale is the " << sscales[sharps] << " scale!\n"; return EXIT_SUCCESS; } else { int flats {0}; cout << "How many flats does your scale have?\n"; cin >> flats; if (!cin){ cerr << "Sorry that is not an acceptable number.\nTry again.\n"; return EXIT_FAILURE; } if (flats > 6) { cout << "Not a possible number of flats in a scale.\n"; return EXIT_FAILURE; } else if (flats > 0) { cout << "Your scale is the " << fscales[flats] << " scale!\n"; return EXIT_SUCCESS; } else { cout << "Your scale is the " << sscales[sharps] << " scale!\n"; return EXIT_SUCCESS; } } }