Lab 01: Create Your First C Console Program
- Learn how to create a console project in Visual C++ or C++Builder IDE
- Visual C++ 2017 or newer edition
- Or C++ Builder 10.3.x or newer edition
- Or XCode in Mac OS X system
There are two types of C/C++ compilers, each of which has advantages and disadvantages:
- Command-line C compilers
- IDE (Integrated Development Environment) or Windows C/C++ compilers
Command-Line C Compilers
If you use a command-line C compiler to compile and execute a C program, you have to go through the following steps:
- Write the C code in a text editor or word processor.
- Save the file as
myfile.cfile in your C project folder.
- Compile the code to a computer-executable program by entering a compiler command at a command prompt, or console window.
For GUN C compiler:
gcc -Wall -o myfile myfile.c
For Microsoft Visual C++ command-line compiler:
For C++Builder compiler:
- Execute the program by entering
at the command prompt. Then you should see the program's results on the screen.
You can use any text editor or code editor that you prefer using with the command-line C compiler. Here are some useful text editors that most programmers are like:
IDE C/C++ Compilers
Integrated Development Environment or IDE for short is an application or software which programmers use for programming. It helps a programmer to program easily by providing all comprehensive facilities required for the development of software. IDE can improve the productivity of a programmer or developer because of its fast setup and various tools. Without this, a programmer takes a lot of time deciding various tools to use for their tasks.
Mainly, an IDE includes 3 parts: source code editor, build automation tool (compiler) and a debugger. The source code editor is something where programmers can write the code, whereas, build automation tool is used by the programmers for compiling the codes and the debugger is used to test or debug the program in order to resolve any errors in the code. Furthermore, these IDEs also comes with additional features like object and data modeling, unit testing, source code library, and a lot more.
Now you will learn how to create a new project for a windows console application in the IDE
Run the code and capture the screen. Paste it to your report.
Extra Useful Information for You!