Presentation is loading. Please wait.

Presentation is loading. Please wait.

C++ Tutorial 1 서강대학교 데이터베이스 연구실.

Similar presentations


Presentation on theme: "C++ Tutorial 1 서강대학교 데이터베이스 연구실."— Presentation transcript:

1 C++ Tutorial 1 서강대학교 데이터베이스 연구실

2 Introduction 1 C++ is almost a superset of the C programming language - generally a C code is valid in C++. but not always, since C++ is stricter than C in some respects (such as typechecking for function parameters) The following is a sample code that works both in C and C++ #include <stdio.h>-instructs the compiler to include the declaration of the standard input/output library functions (which declares "printf" among other things) This program defines a function called main. Every C or C++ program must have a function called main and the program starts by executing this function. The body of this function main contains a call to printf function which writes "Hello, World!₩n" to the standard output. Backslash (“₩") followed by another character denotes a special character: in this case ₩n is a newline character. main is of type int and returns the value 0 to the operating system.

3 Introduction 2 The following program (valid for C++ only) produces the same result as the previous one. This program uses "streams". special classes used for input and output. cout is the standard output stream. The opeator << ("puts to")writes its second argument into the first. In this case. the string "Hello, World!₩n“ is written onto the standard output stream cout.

4 Fundamental Types (Same for C and C++)
Keyword Explanation char character (occupies 1 byte) int integer (occupies 1 word) long int integer (occupies 32bits) float floating point number-single precision (6 digits) double floating point number-double precision (15 digits) int 형은 32bit 를 유지합니다. short 형은 16bit 를 유지합니다. long 형은 32bit에서 64bit로 확장됩니다. long long 형은 64bit 를 유지합니다. pointer 형은 32bit 에서 64bit로 확장딥니다. long double 형이 12bytes 에서 16bytes로 확장됩니다. size_t과 ssize_t 형이 32bit 에서 64bit 로 확장됩니다. 이와 관련된 typedef 문 역시 확장됩니다. 

5 Fundamental Types in 64bit system
Keyword Explanation char 1byte -> 1byte int 32bit -> 32bit long int 32bit -> 64bit long long int 64bit -> 64bit pointer long double 12bytes -> 16bytes size_t / ssize_t int 형은 32bit 를 유지합니다. short 형은 16bit 를 유지합니다. long 형은 32bit에서 64bit로 확장됩니다. long long 형은 64bit 를 유지합니다. pointer 형은 32bit 에서 64bit로 확장딥니다. long double 형이 12bytes 에서 16bytes로 확장됩니다. size_t과 ssize_t 형이 32bit 에서 64bit 로 확장됩니다. 이와 관련된 typedef 문 역시 확장됩니다. 

6 Example Example using basic types

7 Example

8 Derived Types (All exist in C except for reference)

9 Derived Types (All exist in C except for reference)

10 Derived Types (All exist in C except for reference)

11 Derived Types (All exist in C except for reference)

12 Derived Types (All exist in C except for reference)

13 Derived Types (All exist in C except for reference)

14 Derived Types (All exist in C except for reference)


Download ppt "C++ Tutorial 1 서강대학교 데이터베이스 연구실."

Similar presentations


Ads by Google