L1_-_Basic_of_C++_(4_on_1) - Lecture 1 From C to C++ 2---...

Info iconThis preview shows pages 1–4. Sign up to view the full content.

View Full Document Right Arrow Icon

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: Lecture 1 From C to C++ 2--- 64 [CS1102C AY0708S1 Lecture 1] Lecture Overview ¡ Introduction to C++ ¡ Basic Compilation ¡ Review of C & Introduction to C++ ¢ Control Statements ¢ Declarations ¢ Functions ¢ Useful Library in C 3--- 64 [CS1102C AY0708S1 Lecture 1] What is C++? ¡ Developed by Bjarne Stroustrup ¢ First commercial release in 1985 ¢ Originally known as “C with Classes” ¢ Renamed to “C++” in 1983 ¡ Main features: ¢ General purpose ¢ Object Oriented ¢ Compatibility with C ¡ More on this later… 4--- 64 [CS1102C AY0708S1 Lecture 1] The Good and Bad News ¡ Good News: ¢ Only minor incompatibility with C ¡ Most programs introduced in CS1101C is valid and compilable ¢ Proficiency in C++ is a great advantage: ¡ Much sought after in the industry ¡ Picking up other OO languages like Java, C# is relatively easy ¡ Bad News: ¢ It is a HUGE and COMPLEX language ¢ Compatibility with C detracts from pure Object Oriented approach 5--- 64 [CS1102C AY0708S1 Lecture 1] Advice ¡ Unlike CS1101C, we are not concentrating on the programming language itself ¢ C++ coverage is done by lecture 2! ¢ Assume reasonable grasp afterwards ¡ CS1102C is more conceptual based and “higher level” ¢ Ideas that are true regardless of the actual implementation language ¡ However, more than 50% of your CA comes from actual hands-on: ¢ Labs: 20%, PE: 15% ¢ Programming based questions in midterm and finals ¡ Conclusion: ¢ Try hard to be familiar with C++ in the first few weeks Basic Compilation Under Sunfire and Dev C++ 7--- 64 [CS1102C AY0708S1 Lecture 1] Sunfire : How to compile? ¡ Log in to your sunfire account using SSH client ¡ Preliminary Setup (once only): ¢ Check the compiler version by ¡ g++ --version ¡ Should be version 3.3.2 ¢ If the version is incorrect: ¡ Edit your profile using pico, vim etc ¡ vim .profile ¡ Add the following line ¡ alias g++=`/opt/sfw/gcc-3/bin/g++` 8--- 64 [CS1102C AY0708S1 Lecture 1] Sunfire : How to compile? ¡ Note: C++ program has the extension “.cpp” ¡ Example: helloWorld.cpp ¡ Steps for program compilation: 1. Edit program using your favorite editor (vim, pico etc) 2. Compile using the command: g++ -Wall fileName.cpp OR g++ -Wall –o executable_name fileName.cpp 3. [Compilation Error]: Go to step 1 4. Execute the program: a.out OR executable_name 9--- 64 [CS1102C AY0708S1 Lecture 1] If you don’ have the right version Sunfire : Example Screen Preliminary: Check g++ Version Step 1. Edit your C++ source file Step 2. Compile Step 4. Run 10--- 64 [CS1102C AY0708S1 Lecture 1] Dev C++ : How to compile? ¡ Get a local copy of C++ compiler from http://www.bloodshed.net/dev/devcpp.html ¡ Latest version is 4.9.9.2 ¡ Directly run on windows: ¢ No need to log in ¢ Nicer user interface ¢ Easier to use ¡ Caution : Course Marker uses g++ in sunfire ¢ Compile your program in sunfire at least once before submission ¢ Remember to remove Dev C++ specific functions ¡ Like system(“pause”);...
View Full Document

This note was uploaded on 08/02/2009 for the course ECE CS1102C taught by Professor Dr.tansuntuck during the Spring '07 term at National University of Singapore.

Page1 / 16

L1_-_Basic_of_C++_(4_on_1) - Lecture 1 From C to C++ 2---...

This preview shows document pages 1 - 4. Sign up to view the full document.

View Full Document Right Arrow Icon
Ask a homework question - tutors are online