C++ Basics - C++ Programming Tutorial PDF

Title C++ Basics - C++ Programming Tutorial
Author Anonymous User
Course Introduction to programming /c++
Institution Virtual University of Pakistan
Pages 50
File Size 1.6 MB
File Type PDF
Total Downloads 661
Total Views 927

Summary

TABLE OF CONTENTS (HIDE)yet another insignificant programming notes...   |   HOMEC++ Programming LanguageBasicsThis chapter explains the features, technical details and syntaxes of the C++ programming language. I assume that youcould write some simple programs. Otherwise, read &a...


Description

yet another insignificant programming notes... | HOME

TABLE OF CONTENTS (HIDE) 1.Introduction to C++

C++ Programming Language Basics

2.Basic Syntaxes 2.1Revision 2.2Comments 2.3Statements and Blocks 2.4White Spaces and Formatting 2.5Preprocessor Directives

3.Variables and Types This chapter explains the features, technical details and syntaxes of the C++ programming language. I assume that you could write some simple programs. Otherwise, read "Introduction To C++ Programming for Novices and First-time Programmers". To be a proficient programmer, you need to master two things: (1) the syntax of the programming language, and (2) the core libraries (i.e., API) associated with the language.

1.Introduction to C++ C++ Standards C++ is standardized as ISO/IEC 14882. Currently, there are two versions: 1. C++98 (ISO/IEC 14882:1998): First standard version of C++. 2. C++03 (ISO/IEC 14882:2003): minor "bug-fix" to C++98 with no change to the language. Commonly refer to as C++98/C++03 or First C++ standard. 3. C++11 (ISO/IEC 14882:2011): Second standard version of C++. Informally called C++0x, as it was expected to finalize in 200x but was not released until 2011. It adds some new features to the language; more significantly, it greatly extends the C++ standard library and standard template library (STL). 4. C++14: Infomally called C++1y, is a small extension to C++11, with bug fixes and small improvement. 5. C++17: informally called C++1z. 6. C++2a: the next planned standard in 2020.

C++ Features 1. C++ is C. C++ supports (almost) all the features of C. Like C, C++ allows programmers to manage the memory directly, so as to develop efficient programs. 2. C++ is OO. C++ enhances the procedural-oriented C language with the object-oriented extension. The OO extension facilitates design, reuse and maintenance for complex software. 3. Template C++. C++ introduces generic programming, via the so-called template. You can apply the same algorithm to different data types. 4. STL. C++ provides a huge set of reusable standard libraries, in particular, the Standard Template Library (STL).

3.1Variables 3.2Identifiers 3.3Variable Declaration 3.4Constants (const) 3.5Expressions 3.6Assignment (=) 3.7Fundamental Types 3.8Literals for Fundamental Types

4.Operations 4.1Arithmetic Operators 4.2Arithmetic Expressions 4.3Mixed-Type Operations 4.4Overflow/UnderFlow 4.5Compound Assignment Opera 4.6Increment/Decrement Operato 4.7Implicit Type-Conversion vs. Ex 4.8Relational and Logical Operato

5.Flow Control 5.1Sequential Flow Control 5.2Conditional (Decision) Flow Co 5.3Loop Flow Control 5.4Interrupting Loop Flow - "bre 5.5Terminating Program 5.6Nested Loops 5.7Some Issues in Flow Control 5.8Exercises

6.Writing Correct and Good Progr 7.Strings 7.1String Declaration and Initializ 7.2String Input/Output 7.3String Operations 7.4Exercises

8.Formatting Input/Output using 8.1Output Formatting

C++ Strength and Pi tfall C++ is a powerful language for high-performance applications, including writing operating systems and their subsystems, games and animation. C++ is also a complex and difficult programming language, which is really not meant for dummies. For example, to effectively use the C++ Standard Template Library (STL), you need to understand these difficult concepts: pointers, references, operator overloading and template, on top of the object-oriented programming concepts such as classes and objects, inheritance and polymorphism; and the traditional constructs such as decision and loop. C++ is performance centric. The C++ compiler does not issue warning/error message for many obvious programming mistakes, undefined and unspecified behaviors, such as array index out of range, using an uninitialized variable, etc, due to the focus on performance and efficiency rather than the ease of use - it assumes that those who choose to program in C++ are not dummies.

2.Basic Syntaxes 2.1Revision

8.2Input Formatting 8.3Exercises

9.Arrays 9.1Array Declaration and Usage 9.2Array and Loop 9.3Range-based for loop (C++11 9.4Multi-Dimensional Array 9.5Array of Characters - C-String 9.6Exercises

10.Functions 10.1Why Functions? 10.2Using Functions 10.3Default Arguments 10.4Function Overloading 10.5Functions and Arrays 10 6 Pass by Value vs Pass by Re

Below is a simple C++ program that illustrates the important programming constructs (sequential flow, while-loop, and if-else) and input/output. Read "Introduction To C++ Programming for Novices and First-time Programmers" if you need help in understanding this program.

10.7const Function Parameters 10.8Pass-by-Reference via "Refere 10.9Mathematical Functions (Hea 10.10Generating Random Numbe 10.11Exercises

11.File Input/Output (Header upperbound; // Use a while-loop to repeatedly add 1, 2, 3,..., to the upperbound int number = 1; while (number sumEven) { absDiff = sumOdd - sumEven; } else { absDiff = sumEven - sumOdd; } // Print the cout...


Similar Free PDFs