C++ Programming

Summer 2007


Jinn-Liang Liu

高雄大學應數系

 Project 3. (Due 8/8)
1. Rewrite the previous Newton program with all the previous Math and I/O features but now with Newton and Taylor as two classes.
2. The functions
cos(x) and sin(x) and the nonlinear function should be defined outside of these classes and accessed by the objects instantiated by these classes via call by reference.
3. All arrays should be allocated in dynamic memory.
4. Use prototype declaration for both functions and classes, i.e., move all definitions below the main() function.
5. You should submit I/O files as well.
6. In your email to me, write project # and your Chinese name on the
主旨: line.

Project 2. (Due 8/1) Rewrite the previous Newton program with the nonlinear function cos(x) x3  to include the following new features:
Part A. C++: 1. Functions (with declaration, call, definition). 2. Use I/O files instead of cin and cout.
3. Array or pointer.
Part B. Math: 1. Show by an output table that Newton’s method coverges quadratically. 2. Use Taylor series to approximate the functions cos(x) and sin(x) in your program. Read the article about Gottfried Leibniz and Brook Taylor on Wikepedia.

Project 1. (Due 7/25) Write a C++ program for finding a root of a nonlinear function f(x) by using Newton’s method. Read the article about Issac Newton on Wikepedia. Send your program to my email address: jinnliu@nuk.edu.tw.

 

On-line tutorial:   Juan Soulie, C++ Language Tutorial, 2007.

 

1.     Download the free C++ compiler:
Dev-C++ 5.0 beta 9.2 (4.9.9.2) (9.0 MB) with Mingw/GCC 3.4.2.  Dev-C++ 操作指南

2.     Read, copy, compile, and run the examples in the tutorial.

3.     Read the tutorial with, for example: TheFreeDictionary.

4.     Listen and repeat loudly with TheFreeDictionary.

5.     Read! Read! Read! Write! Write! Write! Run! Run! Run!

6.     Create your own programs.

 

Now let’s do it!

C++ Language Tutorial

Published by Juan Soulie Apr 24, 2007  

 

 

0.    C++ Language Tutorial

  

     I. Basics of C++

1.       Structure of a Program

2.       Variables. Data Types.

3.       Constants

4.       Operators

5.       Basic Input/Output

II. Control Structures

6.       Control Structures

7.       Functions (I)

8.       Functions (II)

III. Compound Data Types

9.       Arrays

10.  Character Sequences

11.  Pointers

12.  Dynamic Memory

13.  Data Structures

14.  Other Data Types

IV. Object Oriented Programming

15.  Classes (I)

16.  Classes (II)

17.  Friendship and Inheritance

18.  Polymorphism

19.  Templates

V. Advanced Concepts

20.  Namespaces

21.  Exceptions

22.  Type Casting

23.  Preprocessor Directives

VI.   C++ Standard Library

24.  Input/Output with Files

Appendixes

25.  Ascii Codes

26.  Boolean Operations

27.  Numerical Bases