online compiler and debugger for c/c++

code. compile. run. debug. share.
Source Code    Language
#include <iostream> // std::cout #include <algorithm> // std::rotate #include <vector> // std::vector using namespace std; vector<int>solution(vector<int>& A, int K) { for (size_t i{}; i < K; ++i) { std::rotate(A.begin(), (A.begin() + size(A)-1), A.end()); } // 4 5 6 7 8 9 1 2 3 // print out content: std::cout << "Rotated vector contains:"; for (std::vector<int>::iterator it = A.begin(); it != A.end(); ++it) std::cout << ' ' << *it; std::cout << '\n'; return A; // don't really need this lol } int main() { std::vector<int> myvector; int num{}; cout << "How many numbers do you want to enter?\n"; cin >> num; for (size_t j{}; j < num; ++j) { int val{}; cout << "\nEnter a number to be stored:\n"; cin >> val; myvector.push_back(val); } int count{}; cout << "Enter the number of rotations:\n"; cin >> count; solution(myvector, count); }

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