Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
C++ Tutorial
#1

C++ Tutorial

[attachment=16453]
Learning C++
C++ joins three separate programming traditions: the procedural language tradition, represented by C; the object-oriented language tradition, represented by the class enhancements C++ adds to C; and generic programming, supported by C++ templates. This chapter will look into those traditions shortly. But first, let s consider what this heritage implies about learning C++. One reason to use C++ is to avail yourself of its object-oriented features. To do so, you need a sound background in standard C, for that language provides the basic types, operators, control structures, and syntax rules. So, if you already know C, you re poised to learn C++. But it s not just a matter of learning a few more keywords and constructs. Going from C to C++ involves about as much work as learning C in the first place

A Little History
Computer technology has evolved at an amazing rate during the last few decades. Today a laptop computer can compute faster and store more information than the mainframe computers of 40 years ago. (Quite a few programmers can recall bearing offerings of decks of punched cards to be submitted to a mighty, room-filling computer system with a majestic 100KB of memory not enough memory to run a good personal computer game today.) Computer languages have evolved, too. The changes might not be as dramatic, but they are important. Bigger, more powerful computers spawn bigger, more complex programs which, in turn, raise new problems in program management and maintenance.

The C Language
In the early 1970s, Dennis Ritchie of Bell Laboratories was working on a project to develop the UNIX operating system. (An operating system is a set of programs that manages a computer s resources and handles its interactions with users. For example, it s the operating system that puts the system prompt onscreen and that runs programs for you.) For this work Ritchie needed a language that was concise, that produced compact, fast programs, and that could control hardware efficiently. Traditionally, programmers met these needs by using assembly language, which is closely tied to a computer s internal machine language
Reply

#2

C++ Tutorial

[attachment=17293]
Pointers

int *intPtr;

intPtr = new int;

*intPtr = 6837;

delete intPtr;

int otherVal = 5;
intPtr = &otherVal;

Arrays

Stack allocation

int intArray[10];
intArray[0] = 6837;

Heap allocation

int *intArray;
intArray = new int[10];
intArray[0] = 6837;

..

delete[] intArray;
Reply



Forum Jump:


Users browsing this thread:
1 Guest(s)

Powered By MyBB, © 2002-2024 iAndrew & Melroy van den Berg.