C++Programming-HOWTO.pdf

(235 KB) Pobierz
C++ Programming HOW-TO
C++ Programming HOW−TO
C++ Programming HOW−TO
Table of Contents
C++ Programming HOW−TO. ..........................................................................................................................1
Al Dev (Alavoor Vasudevan) alavoor@yahoo.com. ..............................................................................1
1. Introduction. .........................................................................................................................................1
2. String Class Varieties.. ........................................................................................................................1
3. Best C++ compilers for MS Windows 2000/NT/95/98/ME/XP. ........................................................1
4. Download String . ................................................................................................................................1
5. How Can I trust Al Dev's String Class ?? . ..........................................................................................1
6. Usage of String class. ...........................................................................................................................1
7. String.h file. .........................................................................................................................................1
8. Renaming the String class. ...................................................................................................................2
9. File Class. .............................................................................................................................................2
10. C++ Zap (Delete) function. ...............................................................................................................2
11. Pointers are problems. .......................................................................................................................2
12. Usage of my_malloc and my_free . ...................................................................................................2
13. Debug files. ........................................................................................................................................2
14. Java like API. .....................................................................................................................................2
15. IDE tools for C++ . ............................................................................................................................2
16. C++ Online Textbooks and Docs.. ....................................................................................................2
17. C++ Coding Standards. ......................................................................................................................2
18. C++ Online Docs. ..............................................................................................................................2
19. Memory Tools. ...................................................................................................................................2
20. Related URLs. ....................................................................................................................................2
21. C++ Scripting Languages. .................................................................................................................2
22. Templates. ..........................................................................................................................................3
23. STL References. ................................................................................................................................3
24. Threads in C++. .................................................................................................................................3
25. C++ Utilities ......................................................................................................................................3
26. Other Formats of this Documen.. ......................................................................................................3
27. Translations To Other Languages. .....................................................................................................3
28. Copyright. ..........................................................................................................................................3
29. Appendix A String Program Files . ...................................................................................................3
1. Introduction. .........................................................................................................................................3
1.1 C++ v/s Java. ......................................................................................................................................4
1.2 Which one Ada95, "C", "C++" or Java ??. ........................................................................................4
1.3 Problems facing the current C++ compilers. .....................................................................................5
1.4 COOP − C++ Object Oriented Programming−language. ..................................................................6
2. String Class Varieties. ........................................................................................................................7
2.1 Multiple Inheritance − Sample Custom String class . .......................................................................7
3. Best C++ compilers for MS Windows 2000/NT/95/98/ME/XP. .......................................................8
4. Download String . ...............................................................................................................................9
5. How Can I trust Al Dev's String Class ?? . .........................................................................................9
6. Usage of String class. ...........................................................................................................................9
6.1 Operators. .........................................................................................................................................10
6.2 Functions. .........................................................................................................................................11
7. String.h file. .......................................................................................................................................11
7.1 StringBuffer.h. .................................................................................................................................17
7.2 StringTokenizer.h. ............................................................................................................................18
8. Renaming the String class. .................................................................................................................19
i
22877975.001.png
C++ Programming HOW−TO
Table of Contents
8.1 Case 1: Simple rename. ....................................................................................................................19
8.2 Case 2: Resolve conflic.. .................................................................................................................19
9. File Class. ...........................................................................................................................................20
10. C++ Zap (Delete) function. ............................................................................................................20
11. Pointers are problems. ....................................................................................................................21
12. Usage of my_malloc and my_free . ................................................................................................22
12.1 Garbage Collector for C++ . .........................................................................................................24
13. Debug files. ......................................................................................................................................24
14. Java like API. ...................................................................................................................................24
15. IDE tools for C++ . .........................................................................................................................24
16. C++ Online Textbooks and Docs.. .................................................................................................25
17. C++ Coding Standards. ....................................................................................................................25
18. C++ Online Docs. ............................................................................................................................27
18.1 C++ Tutorials. ................................................................................................................................28
18.2 Useful links. ...................................................................................................................................28
18.3 C++ Quick−Reference. ..................................................................................................................28
18.4 C++ Usenet Newsgroups. ..............................................................................................................28
19. Memory Tools. .................................................................................................................................28
20. Related URLs. ..................................................................................................................................29
21. C++ Scripting Languages. ...............................................................................................................29
21.1 PIKE (C/C++ Scripting Language.. ..............................................................................................29
21.2 SoftIntegration Ch (C/C++ Scripting Language.. .........................................................................30
21.3 PHP (C++ Scripting Language). ....................................................................................................30
22. Templates. ........................................................................................................................................30
23. STL References. .............................................................................................................................31
23.1 Overview of the STL . ...................................................................................................................31
23.2 Header Files. ..................................................................................................................................33
23.3 The Container Classes Interface . ..................................................................................................33
23.4 Vectors . .........................................................................................................................................34
Constructing Vectors . ..............................................................................................................34
Checking Up on Your Vector . .................................................................................................35
Accessing Elements of a Vector . .............................................................................................35
Inserting and Erasing Vector Elements ...................................................................................37
Vector Iterators . .......................................................................................................................38
Comparing Vectors . .................................................................................................................39
23.5 Iterators and the STL. ....................................................................................................................40
23.6 Lists. ...............................................................................................................................................40
23.7 Sets. ...............................................................................................................................................40
Constructing Sets. .....................................................................................................................40
What are Function Objects?. .....................................................................................................41
A Printing Utility. .....................................................................................................................44
How Many Elements?. ..............................................................................................................44
Checking the Equality of Sets. .................................................................................................45
Adding and Deleting Elements. ................................................................................................46
Finding Elements. .....................................................................................................................47
Set Theoretic Operations. .........................................................................................................48
23.8 Maps. ..............................................................................................................................................50
23.9 STL Algorithms. ............................................................................................................................50
ii
22877975.002.png
C++ Programming HOW−TO
Table of Contents
24. Threads in C++. ...............................................................................................................................50
24.1 Threads Tutoria. ............................................................................................................................51
24.2 Designing a Thread Class in C++. .................................................................................................51
Introduction. ..............................................................................................................................51
Brief Introduction To Threads. .................................................................................................51
Basic Approach. ........................................................................................................................52
The Implementation. .................................................................................................................52
Using The Thread Class. ...........................................................................................................53
Conclusion. ...............................................................................................................................54
25. C++ Utilities ....................................................................................................................................54
26. Other Formats of this Documen.. ....................................................................................................54
26.1 Acrobat PDF format. ....................................................................................................................55
26.2 Convert Linuxdoc to Docbook format . ........................................................................................56
26.3 Convert to MS WinHelp format . .................................................................................................56
26.4 Reading various formats . .............................................................................................................56
27. Translations To Other Languages. ...................................................................................................57
28. Copyright. ........................................................................................................................................57
29. Appendix A String Program Files . ................................................................................................57
iii
22877975.003.png
C++ Programming HOW−TO
Al Dev (Alavoor Vasudevan) alavoor@yahoo.com
v40.3, 26 July 2001
This document provides a comprehensive list of C++ URL pointers, links to C++ online textbooks, and
programming tips on C++. This document also provides a C++ library which imitates Java−language, and
which has various methods to avoid memory problems in C++. Using this library you can compile Java's
source code under C++. This document serves as a "Home of C++ language". The information given here
will help you to program properly in C++ language and applies to all the operating systems that is − Linux,
MS DOS, BeOS, Apple Macintosh OS, Microsoft Windows 95/98/NT/2000, OS/2, IBM OSes (MVS, AS/400
etc..), VAX VMS, Novell Netware, all flavors of Unix like Solaris, HPUX, AIX, SCO, Sinix, BSD, etc.. and to
all other operating systems which support "C++" compiler (it means almost all the operating systems on this
planet).
·
·
·
·
C++ Programming HOW−TO
1
22877975.004.png
Zgłoś jeśli naruszono regulamin