tailieunhanh - Lecture Introduction to computer and programming - Lecture No 31
This chapter introduced inheritancethe ability to create classes by absorbing an existing class's members and enhancing them with new capabilities. You learned the notions of base classes and derived classes and created a derived class that inherits members from a base class. The chapter introduced access modifier protected; derived class methods can access protected base class members;. Finally, you learned about Software Engineering with Inheritance. | CSC103: Introduction to Computer and Programming Lecture No 32 Previous lecture Console I/O formatting sprintf ( ) and sscanf( ) Library Static library How to make C static library using Dev Cpp Today’s lecture outline Apply I/O formatting in database management program Make our database management library Bit wise operator Bitwise operator So far we have dealt with characters, integers, floats and their variations the smallest unit of memory that we have operated until now is byte A single byte consists of 8 bits Bitwise operator allow us to perform manipulation on individual bit This is very important when your program interact with hardware Cont. Bitwise Operators available in C are These operators can operate upon int and char but not on float and double Operator Meaning ~ One’s complement >> Right shift > It needs two operands It shifts each bit in its left operand to the right Number of places the bits are shifted depends on the number following the operator ch >> 3 would shift all bits in ch three places to the right ch >> 5 would shift all bits 5 places to the right if the variable ch contains the bit pattern 11010111 ch >> 1 would give 01101011 ch >> 2 would give 00110101 Cont. As the bits are shifted to the right, blanks are created on the left These blanks are always filled with zeros. 1 1 0 1 0 1 1 1 7 6 5 4 3 2 1 0 One bit right shift 0 1 1 0 | CSC103: Introduction to Computer and Programming Lecture No 32 Previous lecture Console I/O formatting sprintf ( ) and sscanf( ) Library Static library How to make C static library using Dev Cpp Today’s lecture outline Apply I/O formatting in database management program Make our database management library Bit wise operator Bitwise operator So far we have dealt with characters, integers, floats and their variations the smallest unit of memory that we have operated until now is byte A single byte consists of 8 bits Bitwise operator allow us to perform manipulation on individual bit This is very important when your program interact with hardware Cont. Bitwise Operators available in C are These operators can operate upon int and char but not on float and double Operator Meaning ~ One’s complement >> Right shift << Left shift & Bitwise AND | Bitwise OR ^ Bitwise XOR(Exclusive OR) Bit numbering scheme of character Bit numbering of integer Showbit(int i) function Bit numbering scheme 7 6 5
đang nạp các trang xem trước