online compiler and debugger for c/c++

code. compile. run. debug. share.
Source Code   
Language
/*************************************************************** * Name: Prof. Orta * Course: Computer Science & Programming * Class: CS04103 Section: 1 & 2 * Assignment Date: 10/27/20 * File Name: BubbleSort.cpp ***************************************************************** * ID: 001 * Purpose: Explain Bubble Sort in C++ *****************************************************************/ #include <iostream> #include <ctime> #include <stdlib.h> using namespace std; int main() { // Declaring variables int array[10]; int value = 0, counter = 0, temp = 0, medium = 0, left = 0, right = 8; // Inserting random numbers to the array of 10 elements. srand (time(0)); for (int x = 0 ; x < 9 ; x++) { array[x] = rand() % 9 + 1; } // Displaying the array unsorted system("clear"); cout << "\n --------- Array unsorted --------" << endl; cout << "\n -------------------------------------" << endl; for (int x = 0 ; x < 9 ; x++) { cout << " | " << array[x]; } cout << " |\n -------------------------------------" << endl << endl; // Sorting the array ascending using Buble sort algorithm for (int x = 0; x < 9; x++) { for (int y = 0; y < 9-x-1; y++) { if (array[y] > array[y+1]) { cout << "Swapping: " << array[y] << " with array " << array[y+1] << endl; temp = array[y] ; array[y]= array[y+1]; array[y+1] = temp; } } } // Displaying the array sorted cout << "\n - Array sorted using Buble Sort -" << endl; cout << "\n -------------------------------------" << endl; for (int x = 0 ; x < 9 ; x++) { cout << " | " << array[x]; } cout << " |\n -------------------------------------" << 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