-
I guess I can only write like this upstairs. However, there is still a big gap between this writing and the standard text input function of the console (such as scanf), such as not being able to use the arrow keys, not being able to use home end, etc. Of course, you can add these features yourself, but it's always hard to do it all, since the standard functions of other consoles have been improved over generations.
Note that gotoxy() is provided by Borland, not an ANSI function, and not all compilers can use it. For example, VC is not good. So it still doesn't count"Pure c"solution.
-
Summary. The input and output of data in C is usually implemented using functions from standard I/O libraries. Among them, the functions that input data mainly include scanf(), and the functions that output data mainly include printf().
The C language uses function calls to complete the input and output process of data, and its functions are composed of.
Hello dear, the C language uses function calls to complete the input and output process of data:
The I/O of the C language usually uses functions from the standard I/O library to implement the input and output of plex balance data. Among them, the functions of the input data mainly lead guess scanf(), and the functions of the output data mainly include the Huai Zheng type printf().
In the program, by calling these functions, the input and output of data can be completed. For example:
#include int main()
In the above program, scanf and printf are used to complete the data input and output. First, the program sends a hint to the standard output stream, and then calls the scanf function to read an integer from the standard input stream and store it in the number of transformers, num. Finally, the value of the variable num is formatted and output into the standard output stream using the printf function.
-
The format description consists of "%" and format characters, such as %d%f, etc. What it does is to convert the output data into a specified format output. Format descriptions always start with the "%" character. Different types of data use different format characters.
Format characters include d, o, x, u, c, s, f, e, g, etc.
For example, %d integer input output, %ld long integer input output, %o input output integer as octal number, x input output integer as hexadecimal number, u input and output unsigned data (unsigned number) as decimal number.
c is used to input output a character, s is used to input output a string, f is used to input output real numbers, output as decimals, (Note: floating-point numbers cannot define the precision of the input, so scanf("%a) is "wrong"!!)
e outputs real numbers exponentially, g automatically selects f format or e format according to size, and does not output meaningless zeros.
scanf (control character, address list).
The meaning of the format character is the same as the printf function, and the address list is a table column composed of several addresses, which can be the address of a variable or the first address of a string. Such as scanf("%d%c%s",&a,&b,str)
#include
void main() >>>More
It's nonsense to say so much above. Landlord please see: pay attention to your program: printf("%d,%d",(a,b),(b,a); >>>More
First of all, since 2 instances of the test class were created. >>>More
1. First of all, define a number of reed structure student, which contains the information of the student. >>>More