online compiler and debugger for c/c++

code. compile. run. debug. share.
Source Code    Language
// ChordPicker.cpp : This file contains the 'main' function. Program execution begins and ends there. // #include <iostream> #include <stdlib.h> #include <time.h> #include <vector> using namespace std; int main() { srand(time(NULL)); char notes[] = "ABCDEFG"; char accents[] = " #b"; const int MAJOR = 1, MINOR = 2, DOM7 = 4, MAJ7 = 8, MIN7 = 16; int major = 0, minor = 0; vector<string> qualities = {}; cout << "1:Major, 2:minor, 3:Dom7, 4:Maj7, 5:min7 (type corresponding numbers separated by space/enter)" << endl; cout << "Type '-1' when done" << endl; //input to choose chords: vector<int> vInput; int input = 0; while (true) { int temp; cin >> temp; if (temp == -1) break; temp = 1 << temp - 1; // temp = 2 ^ (temp - 1) vInput.push_back(temp); } for (int i = 0; i < vInput.size(); i++) { input += vInput[i]; } if (input & MAJOR) qualities.push_back("major"); if (input & MINOR) qualities.push_back("minor"); if (input & DOM7) qualities.push_back("dom7"); if (input & MAJ7) qualities.push_back("maj7"); if (input & MIN7) qualities.push_back("min7"); //turn up a random chord! while (cin.get()=='\n') { cout << notes[rand() % 7] << accents[rand() % 3] << " " << qualities[rand() % qualities.size()] << ", root on string " << rand() % 4 + 3 << endl; } return 0; }

Compiling Program...

Command line arguments:
Standard Input: Interactive Console Text
×

                

                

Program is not being debugged. Click "Debug" button to start program in debug mode.

#FunctionFile:Line
VariableValue
RegisterValue
ExpressionValue