compilling c++ and c by console

Step 1: Install a C++ compiler and a C compiler on your system, such as GCC (GNU Compiler Collection).

Step 2: Open a console or terminal window.

Step 3: Navigate to the directory containing your C++ source code file using the 'cd' command.

Step 4: Compile the C++ source code using the following command:

g++ -o output_filename source_filename.cpp

Replace "output_filename" with the desired name for the compiled executable and "source_filename.cpp" with the name of your C++ source code file.

Step 5: Run the compiled C++ program using the following command:

./output_filename

Replace "output_filename" with the name you specified in the compilation step.

For compiling C code, use the following command:

gcc -o output_filename source_filename.c

Replace "output_filename" with the desired name for the compiled executable and "source_filename.c" with the name of your C source code file.

To run the compiled C program, use the command:

./output_filename

Replace "output_filename" with the name you specified in the compilation step.