Lab C++ 00 - Introduction To C Compiler

  • Uploaded by: safuan_alcatra
  • 0
  • 0
  • May 2020
  • PDF

This document was uploaded by user and they confirmed that they have the permission to share it. If you are author or own the copyright of this book, please report to us by using this DMCA report form. Report DMCA


Overview

Download & View Lab C++ 00 - Introduction To C Compiler as PDF for free.

More details

  • Words: 451
  • Pages: 6
UNIVERSITI KUALA LUMPUR MALAYSIA FRANCE INSTITUTE

Lab 00 - Introduction to C Compiler (PRG3012/PRG0012) 1.0 Introduction to C Compiler Dev-C++, developed by Bloodshed Software, is a fully featured graphical IDE (Integrated Development Environment), which is able to create Windows or consolebased C/C++ programs using the MinGW compiler system. MinGW (Minimalist GNU* for Windows) uses GCC (the GNU g++ compiler collection), which is essentially the same compiler system that is in Cygwin (the unix environment program for Windows) and most versions of Linux. There are, however, differences between Cygwin and MinGW; link to Differences between Cygwin and MinGW for more information. *GNU is a recursive acronym for "GNU's Not Unix"; it is pronounced "guh-NEW". The GNU Project was launched in 1984 to develop a free and complete Unix-like operating system. [source: http://www.uniqueness-template.com/devcpp/]

Dev C++ window

UNIVERSITI KUALA LUMPUR MALAYSIA FRANCE INSTITUTE

2.0 Creating application 1. Execute Dec C++ 2. Under menu File->Project… press click

3. The following dialog box will appear.

• • •

Select console application In the “Name:” textbox type the project name Click OK

UNIVERSITI KUALA LUMPUR MALAYSIA FRANCE INSTITUTE

4. The following dialog box will appear

• •

Type the “File name:” (*Create a directory to save the project) Click “Save”

5. A window with C++ source code template will appear

UNIVERSITI KUALA LUMPUR MALAYSIA FRANCE INSTITUTE

6. In the “main.cpp” window type following code will be created by default. #include #include using namespace std; int main(int argc, char *argv[]) {

system("PAUSE"); return EXIT_SUCCESS; }

DO NOT DELETE/MODIFY THE EXISTING C++ CODE… 7. Any modification/additional C++ code must be done between: int main(int argc, char *argv[]) {

Type your C++ code here system("PAUSE"); return EXIT_SUCCESS; }

8. Add the following line to the code cout<<"Helloooooo...."<<;

9. The full C++ code in the “main.cpp” window #include #include using namespace std; int main(int argc, char *argv[]) { cout<<"Helloooooo...."<<;

}

system("PAUSE"); return EXIT_SUCCESS;

UNIVERSITI KUALA LUMPUR MALAYSIA FRANCE INSTITUTE

10. Select the menu Execute->Compile & Run or press F9 to compile the C++ code

11. The C++ code in the “main.cpp” window will be highlighted, indicating there is error in the code.

UNIVERSITI KUALA LUMPUR MALAYSIA FRANCE INSTITUTE

12. Fix the error change the cout<<"Helloooooo...."<<;

TO cout<<"Helloooooo...."<<endl;

13. Press “F9” or select Execute->Compile & Run to compile the code. 14. If the compilation is successful the code an .exe (executable) file will be created the following window will appear.

15. Look in the project folder that you have created earlier, there is an .exe (executable) file created by the C++ compiler. 3.0 EXERCISE Create a new project named MyProject, add the following C++ code in the main.cpp cout<<"Hello, I’am ..."<<endl; cout<<"This is my first C++ program."<<endl; cout<<endl<<endl;

Related Documents