xxxxxxxxxx
$ g++ -o <name-you-want-to-give> source.cpp
./myprogram
xxxxxxxxxx
# Open Terminal:
# Type:
g++ --version
# If the command is not recognized:
sudo apt-get install g++
g++ --version # should work now
# If the command is recognized
mkdir tmp
cd tmp
touch main.cpp
# open main.cpp using vi, vim, gedit, etc
# Type in a hello world program:
# https://www.tutorialspoint.com/cplusplus-hello-world-program
# Once this has been done, type in:
g++ main.cpp
./a.out
xxxxxxxxxx
#include <graphics.h>
main()
{
int x = 50, y = 400, r = 50, d = 1;
initwindow(600, 600);
while(1)
{
setcolor(14);
circle(x, y, r);
delay(10);
setcolor(0);
circle(x, y, r);
if(x == 49 || x == 550)
d = d * -1;
x = x + d;
}
getch();
}