Summary of the third software engineering job

1. Comparison of getchar () and getch ()

The header file for getchar () is stdio.h; the header file for getch () is conio.h; in VS, getch () is written as _getch ().

The characters entered by getchar () will be displayed. The characters entered by getch () are not displayed.

When entering data, getchar () reads data from the buffer, and getch () reads data directly from the keyboard.

getchar reads carriage return and returns '\ n';

Getch reads Enter and returns '\ r'.

For details, please refer to this article

2. On the ascall code table of the key values ​​of the up, down, left, and right of the keyboard
: 72
down: 80
left: 75
right: 77
3, system ():

Header file stdlib.h,

Function: issue a dos command;

Commonly used are:

system ("pause") can realize the freezing screen, which is convenient for observing the execution result of the program;

system ("CLS") can realize clear screen operation;

system ("color 0B") and calling the color function can change the foreground and background of the console.

For details, refer to [Baidu Wenku] ( https://wenku.baidu.com/view/76ce784cfe4733687e21aad0.html ) and [Baidu Encyclopedia] ( https://baike.baidu.com/item/system/15078602?fr=aladdin ) knowledge.

4. Comparison of define and const:

Detailed reference [Baidu Encyclopedia] ( https://baike.baidu.com/item/CONST/1036?fr=aladdin )

 

Guess you like

Origin www.cnblogs.com/cccf/p/12687794.html