CPPwithMosh

Run Settings
LanguageC++
Language Version
Run Command
#include <iostream> using namespace std; int main() { // Hello, world! cout << "Hello World!"; cout << endl; cout << "This is a C++ program."; cout << endl << endl; // Swapping values int box1 = 3; int box2 = 5; int temp = 0; cout << "Before: " << box1 << " " << box2 << endl; temp = box1; box1 = box2; box2 = temp; cout << "After: " << box1 << " " << box2 << endl; cout << endl; // Addition int x = 3; int y = 5; int z = x + y; cout << x << " + " << y << " = " << z << endl; // Subtraction int a = x - y; cout << x << " - " << y << " = " << a << endl; // Multiplication int b = x * y; cout << x << " * " << y << " = " << b << endl; // Division double i = 3.0; double l = 5.0; double c = i / l; cout << i << " / " << l << " = " << c << endl; // Modulus int d = x % y; cout << x << " % " << y << " = " << d << endl; // Increment/decrement int counter1 = 0; cout << endl << "counter1: " << counter1 << endl; cout << "counter1 (incremented, postfix): " << counter1++ << endl; // Postfix cout << "counter1: " << counter1 << endl; int counter2 = 0; cout << endl << "counter2: " << counter2 << endl; cout << "counter2 (incremented, prefix): " << ++counter2 << endl; // Prefix cout << "counter2: " << counter2 << endl; return 0; }
Editor Settings
Theme
Key bindings
Full width
Lines