tailieunhanh - Lecture Introduction to computer and programming - Lecture No 30

The contents of this chapter include all of the following: Can conditionally compile code, can control line numbers and file names reported by compiler, can emit warnings and errors, can define logical regions of source code. | CSC103: Introduction to Computer and Programming Lecture No 30 Previous lecture Database Management system Adding a record Displaying all records Modify a record Delete a record Seeking in file through fseek ( ) function Today’s lecture outline Database management program Console I/O formatting sprintf ( ) and sscanf( ) Database management program It is capable to Add record : make sure that file pointer points to end of file Display record : make sure that file pointer point to the beginning of file Modify record : make sure that file pointer point to the beginning of file Delete record : make sure that file pointer point to the beginning of file Go to program Console formatting The screen and keyboard together are called a console Console I/O functions can be further classified into two categories—formatted and unformatted console I/O functions. Name Roll No CGPA Ali 102 Ahmad Unformatted output Name Roll No CGPA Ali 102 Ahmad Formatted output Console I/O function Formatted function Unformatted function Type Input Output char scanf( ) printf( ) int scanf( ) printf( ) float scanf( ) printf( ) string scanf( ) printf( ) Type Input Output char getch( ) getche( ) getchar( ) putch( ) putchar( ) int - float - string gets( ) puts( ) Formatted Console I/O Functions General form of printf ( ) function printf( “formatted string”, list of variables); Formatted string contains Characters that are simply printed as they are Conversion specifications that begin with a % sign Escape sequences that begin with a \ sign Character printed as they are % sign for variable values Escape sequence Format Specifications %d %c and %f used in the printf( ) are called format specifiers They tell printf( ) function the type of value of a variable C language provide following optional specifiers in the format specifications Specifier Description dd digits specifying field width . separating field width from precision dd Digit specifying precision - Sign for . | CSC103: Introduction to Computer and Programming Lecture No 30 Previous lecture Database Management system Adding a record Displaying all records Modify a record Delete a record Seeking in file through fseek ( ) function Today’s lecture outline Database management program Console I/O formatting sprintf ( ) and sscanf( ) Database management program It is capable to Add record : make sure that file pointer points to end of file Display record : make sure that file pointer point to the beginning of file Modify record : make sure that file pointer point to the beginning of file Delete record : make sure that file pointer point to the beginning of file Go to program Console formatting The screen and keyboard together are called a console Console I/O functions can be further classified into two categories—formatted and unformatted console I/O functions. Name Roll No CGPA Ali 102 Ahmad Unformatted output Name Roll No CGPA Ali 102 Ahmad Formatted output Console I/O

TỪ KHÓA LIÊN QUAN