Pure Programmer
Blue Matrix


Cluster Map

Project: Incrementing a Variable

Write a program that creates an integer variable named x with the value 1. Print the variable. Then increment the variable by 1 then 2 then 3, printing it after each change. Then decrement the variable three times, by 3 then 2 then 1, printing the value each time.

Output
$ g++ -std=c++17 IncrementingAVariable.cpp -o IncrementingAVariable -lfmt $ ./IncrementingAVariable 1 2 4 7 4 2 1

Solution