Welcome to Scribd, the world's digital library. Read, publish, and share books and documents. See more
Download
Standard view
Full view
of .
Save to My Library
Look up keyword
Like this
4Activity
0 of .
Results for:
No results containing your search query
P. 1
Essential C the Best

Essential C the Best

Ratings:

4.0

(3)
|Views: 1,431|Likes:
Published by zubair.arshad
A good tool for those who want to learn programming
A good tool for those who want to learn programming

More info:

Published by: zubair.arshad on Mar 06, 2009
Copyright:Attribution Non-commercial

Availability:

Read on Scribd mobile: iPhone, iPad and Android.
download as PDF, TXT or read online from Scribd
See more
See less

09/05/2011

pdf

text

original

 
SECTION
I
C++ Fundamentals
T
he purpose of this section is simply to lay down the foundations ofC++. These are the core concepts in programming and in C++ thatyou will need throughout this book. Although the examples in this sec-tion are not as exciting as those in later sections, they are very important.If you do not master the topics in this section, you will be unable tomaster the rest of this book. At the end of this section, you should be ableto write basic C++ programs. These first nine chapters represent the coreof C++. You cannot even begin to consider yourself a programmer, muchless a C++ programmer, if you do not master these first eight chapters.
 
CHAPTER
1
C++ Basics
IN THIS CHAPTER
History of C++What Is C++?How to Write a C++ ProgramC++ FundamentalsStatements and ExpressionsBasic Structure of a C++ ProgramFunction BasicsVariable ScopeCompilingCommenting Your Code
W
elcome to C++! This first chapter will provide you with some basicfoundational material you will need to progress through the rest ofthe book. In this chapter you will be introduced to the history of C++, the basics of the language, and how to use variables and write expressions inC++. These fundamental concepts are the essential building blocks thatyou will use to create C++ programs throughout the rest of this book.
 
HISTORY OF C++
C++, as the name implies, is essentially based on the C programming lan-guage. Therefore, it seems prudent to begin with a brief history of C. TheC programming language was devised in the early 1970s at Bell Labora-tories by Dennis Ritchie. It was designed as a system implementation lan-guage for the Unix operating system. The history of C and Unix areclosely intertwined. For this reason a lot of Unix programming is donewith C. To some extent, C was originally based on the typeless languageBCPL, however it grew well beyond that.The C++ programming language was invented by Bjarne Stroustroup.Work on what would become C++ began in 1979. The initial version wascalled “C with Classes.” That name did not work out well, and wasreplaced with C++. The first version of C++ was used internally in AT&Tin August 1983. The first commercial implementation was released in1985. The C++ language standards are now handled by the AmericanNational Standards Institute (ANSI), and the International StandardsOrganization (ISO). This is why you often hear pure C++ referred to asANSI Standard C++, or ISO Standard C++.
HINT!
Pure C++ is mentioned because there are a lot of extensionsthat are specific to a particular compiler or operating system. A few of these are covered in this book, but are identified asbeing nonstandard.
WHAT IS C++?
You can see that the C programming language was developed first, C++was developed later. You might be asking yourself what, exactly, is C++and how does it relate to C? The answer is that C++ is essentially C takento the next level. The most obvious difference between the two is thatC++ supports object orientation (more on that in Chapters 10, 11, and 12).However, C++ sports many other improvements over C. For example,C++ handles strings better than C, and has a more robust exception han-dling. (Exception handling refers to a program’s ability to handle unex-pected errors. What if the user inputs a zero then tries to divide by that
4
C++ Programming Fundamentals

Activity (4)

You've already reviewed this. Edit your review.
1 thousand reads
1 hundred reads
Vinay Challuru liked this
himtajay liked this

You're Reading a Free Preview

Download
/*********** DO NOT ALTER ANYTHING BELOW THIS LINE ! ************/ var s_code=s.t();if(s_code)document.write(s_code)//-->