C vs C++ CS-240 Data Structures Binghamton University Dick Steflik.

Slides:



Advertisements
Similar presentations
CS 11 C track: lecture 7 Last week: structs, typedef, linked lists This week: hash tables more on the C preprocessor extern const.
Advertisements

Linux vs. Windows. Linux  Linux was originally built by Linus Torvalds at the University of Helsinki in  Linux is a Unix-like, Kernal-based, fully.
C++ & Java Dick Steflik CS-248. Similarities Syntax - almost identical Object Model - very similar Stream based I/O.
INTRODUCTION T.Najah Al_Subaie Kingdom of Saudi Arabia Prince Norah bint Abdul Rahman University College of Computer Since and Information System CS240.
Protection. Goals of Protection Operating system consists of a collection of objects, hardware or software Each object has a unique name and can be accessed.
COSC 120 Computer Programming
1 Key Concepts:  Why C?  Life Cycle Of a C program,  What is a computer program?  A program statement?  Basic parts of a C program,  Printf() function?
Session 1 CS-240 Data Structures Binghamton University Dick Steflik.
CS201 - Information. CS201 - Laboratories All labs will be done using Linux on the PC’s or esus. All labs MUST use Makefiles. First lab is due NEXT WEEK.
CS-341 Dick Steflik Introduction. C++ General purpose programming language A superset of C (except for minor details) provides new flexible ways for defining.
CS-341 Dick Steflik Introduction. C++ General purpose programming language A superset of C (except for minor details) provides new flexible ways for defining.
Chapter 14: Protection.
Chapter 5 System Software.
Silberschatz, Galvin and Gagne ©2009 Operating System Concepts – 8 th Edition Chapter 2: Operating-System Structures Modified from the text book.
Chapter 2 INSTALLTION OF LINUX DISTRIBUTION. Minimum hardware requirement 1) DVD drive: You must have a DVD drive (either DVD-ROM or DVD burner), and.
CMSC 202 Computer Science II for Majors Fall 2009 Introduction.
Linux Operating system
Unix Presentation. What is an Operating System An operating system (OS) is a program that allows you to interact with the computer -- all of the software.
COMPUTER PROGRAMMING. Introduction to C++ History Merges notions from Smalltalk and notions from C The class concept was borrowed from Simular67 Developed.
Linux Shell. 2 Linux Command-Line Interface ■ Linux shells: A shell is a command interpreter that allows you to type commands from the keyboard to interact.
Getting Started With Java Downloading and installing software Running your first program Dr. DwyerFall 2012.
Microsoft vs Linux Microsoft Applications compared to free opensource software.
Linux GUI Chapter 5. Graphical User Interface GUI vs. CLI Easier and more intuitive More popular and advanced Needed for graphics, web browsing Linux.
COMP1070/2002/lec3/H.Melikian COMP1070 Lecture #3 v Operating Systems v Describe briefly operating systems service v To describe character and graphical.
INTRODUCTION TO C PROGRAMMING LANGUAGE Computer Programming Asst. Prof. Dr. Choopan Rattanapoka and Asst. Prof. Dr. Suphot Chunwiphat.
The Basics  Operating systems (OS) can help computer users do many things, like managing and manipulating files and folders.  Operating systems also.
Operating Systems AOIT Principles of Information Technology.
유닉스, 왜 공부하나 ? 자동화 –GUI vs commands 서버 개발 능력, 관리 능력 – 데스크탑에서의 개발과 관리와의 차이 ?
CS Tutorial 1 Getting Started with Visual Studio 2012 (Visual Studio 2010 are no longer available on MSDNAA, please choose Visual Studio 2012 which.
2INC0 Operating Systems Introduction to Linux
Instructor: Tina Tian. About me Office: RLC 203A Office Hours: Wednesday 1:30 - 4:30 PM or .
Chap 1 ~ Introducing LINUX LINUX is a free-stable multi-user operating system that derives from UNIX operating system Benefits: 1) Linux is released under.
Lecture 0 CIS 208 C Language Lab Wed. January 12, 2005.
CS 444 Introduction to Operating Systems
Making MINT64OS Chan Seok Kang 2013/01/21. 2Computer Systems and Platforms Lab Content Introduction My Approach Encountered Problem Conclusion & Future.
N from what language did C++ originate? n what’s input, output device? n what’s main memory, memory location, memory address? n what’s a program, data?
System Software Chapter Copyright © 2011 by The McGraw-Hill Companies, Inc. All rights reserved.
CS2204: Introduction to Unix January 19 th, 2004 Class Meeting 1 * Notes adapted by Christian Allgood from previous work by other members of the CS faculty.
CMSC 202, Version 3/02 1 Copy Constructors and Overloaded Assignment.
Chapter 1 Computers, Compilers, & Unix. Overview u Computer hardware u Unix u Computer Languages u Compilers.
C++ (intro) Created by Hwansoo Han Edited by Ikjun Yeom.
CSC Programming for Science Lecture 37 : Course Review.
DEF & FACTS! C + 1 = C++ C & C++ ARE MIDDLE LEVEL LANGUAGES INTRODUCTION BRIEF REVIEW OF C NEED OF C++ © arbit club cu 2010.
Gorman, Stubbs, & CEP Inc. 1 Introduction to Operating Systems Lesson 8 Linux.
What is O.S Introduction to an Operating System OS Done by: Hani Al-Mohair.
 Prepared by: Eng. Maryam Adel Abdel-Hady
Chapter 1 slides1 What is C? A high-level language that is extremely useful for engineering computations. A computer language that has endured for almost.
Operating Systems A Biswas, Dept. of Information Technology.
Software Engineering Algorithms, Compilers, & Lifecycle.
Chap 1 ~ Introducing LINUX LINUX is a free-stable multi-user operating system that derives from UNIX operating system Benefits: 1) Linux is released under.
Introduction to unix. The UNIX Operating System An operating system "OS” is a set of programs that controls a computer. It controls both the hardware.
Operating Systems Introduction Moti Geva
Feeling Linux yourself Dr. Tran, Van Hoai Faculty of Computer Science and Engineering HCMC Uni. of Technology
GNU and Linux.
Precept I : Lab Environment, Unix, Bash, Emacs
CS1010: Intro Workshop.
Version Control and Source Code Control Systems
Prepared by: Eng. Maryam Adel Abdel-Hady
LINUX WINDOWS Vs..
Operating System Concepts
KERNEL ARCHITECTURE.
LINUX WINDOWS Vs..
Linux Programming Environment How to Run Linux in Windows
Chapter 2: Operating-System Structures
C Programming Lecture Series
Chapter 2: System Structures
Computer Electronic device Accepts data - input
Computer Electronic device Accepts data - input
Your first C and C++ programs
Compile and run c files.
Presentation transcript:

C vs C++ CS-240 Data Structures Binghamton University Dick Steflik

C++ was originally developed to be the next version of C, not a new language.

Similarities ● same built-in data types ● same compiler preprocessor – handles #include & #define – conditional preprocessing #if, #ifndef and #endef ● same built-in operators on primitive types (+- /*……)

Similarities (cont.) ● Same built-in control structures – if, for, while, switch …. ● must have a function names “main” to determine where the program starts ● functions are defined the same way ● programs can be split up into separate files

Differences ● in C all code exists in function and the paradigm is that you manipulate data with functions ● in C++ classes are used to model the behavior of data objects, behavior is represented by functions and those functions are used to modify the object’s data

Differences (cont.) ● in C a struct is used to make an aggregate type and cannot have associated functions ● in C++ struct there may be associated (part of the struct) functions to process the data ● in C I/O is accomplished via library functions, in C++ it is done by using object methods.

Differences ● C++ has function overloading (two functions may have the same name), in C function names must be unique. ● C++ has operator overloading (operators can be redefined to do other things) ● C++ uses “nbew” and “delete” for dynamic memory management, C uses “malloc” and “free”

Simple C Program # include int main(void) { printf(“Hello World\n”); return 0; }

Software development in CS-240 ● various version of the GNU C++ Compiler – cygwin – unix like environment is on all PODS windows machines – Debian Linux – on all Linux Lab Machines – KNOPPIX – a bootable CDROM version of Linux (bring a 700 Mb CD to my office and I will burn a copy for you) – coLinux – installs as an icon on your Wondows desktop, KDE version of Debian (this is an easy way to get wireless internet for Linux). I will help you do this if you want to try it. Doesn’t require dual boot or a full Linux install – available on your Sun accounts – Eclipse w/c++ plugin and w/minGW – GUI IDE on Windows – Eclipse w/C++ plugin - GUI IDE on Linux

Simple C++ Program #include int main(void) { cout << “Hello World\n”; return 0; }