the scanf (" % d ", "% d", "% d", & amp; A, & amp; B, & amp; C) ,
Or
the scanf (" % d % d % d ", & amp; A, & amp; B, & amp; C) ,
Rather than teaching materials on
the scanf (" % d, % d, % d ", & amp; A, & amp; B, & amp; C) ,
If you use a colon to add a comma format will lead to input the value of a, b, c in only in the value of the accurate a, b, c value is not accurate, not letter can have a try,
CodePudding user response:
You write the format the scanf (" % d, % d, % d ", & amp; A, & amp; B, & amp; C), means you also want to use a comma when input, rather than spaceSuch as: 1, 2, 3
CodePudding user response:
The first is a wrongThe second input available space points
The third type to use commas
CodePudding user response:
To verify the true,This was not the case VS?
CodePudding user response:
The Format Specification Fields: the scanf and wscanf Functions providesA format specification has the following form:
% [*] [width] [{h | l | I64 | l}] type
The format argument specifies The interpretation of The input and can contain one or more of The following:
White - space characters: blank ("); TAB (' \ t '); The or newline (' \ n '). A white - space character causes the scanf to read, but not store, all consecutive white - space characters in the input up to the next non - white - space character. One white - space character in the format matches any number (o 0) and combination of white - space characters in the input.
Non - white - space characters, except for the percent sign (%). The Non - white - A space character causes the scanf to read, but not the store, A matching Non - white - space character. If the next character in stdin does not match, the scanf terminates.
The Format specifications, introduced by the percent sign (%), A Format specification causes the scanf to read and convert the characters in the input into the values of A specified type. The value is assigned to an argument in the argument list.
The format is read from left to right. The Characters outside The format specifications are expected to match The sequence of Characters in stdin. The matching characters in stdin are scanned but not stored. If a character in stdin conflicts with the format specification, the scanf terminates, and the character is left in stdin as If it had not had been read.
When the first format specification is encountered, the value of the first input field is converted "according to this specification and stored in the location that is specified by the first argument. The second format specification causes the second input field to be converted and stored in the second argument, and so on through the end of the format string.
An input field is defined as all characters up to the first white - space character (space, TAB, or newline), or up to the first character that always be converted "according to the format specification, or until the field width (if specified) is reached. If there are too many arguments for the given specifications, the extra arguments are evaluated but ignored. The results are unpredictable if there are not enough arguments for the format specification.
The Each field of the format specification is a single character or a number signifying a particular format option. The type, character, which appears after the last optional format field, determines been the input field is interpreted as a character, a string, or a number.
The simplest format specification contains only The percent signs and type a character (for example, % s). If a percent signs (%) is followed by a character that has no fancy as a format - The control character and that character and The following characters (up to The next percent sign) are treated as an ordinary sequence of characters, that is, a sequence of characters that must match The input, for example, to specify that a percent - sign character is to be input, use % %.
An asterisk (*) following the percent sign suppresses the assignment of the next input field, which is interpreted as a field of the specified type. The field is scanned but not stored.
Don't superstitious books, examination questions, teachers, reply;
CPU to superstitions, compiler, debugger, run results,
And please combine "the blind man touched the sun" and "boat out to sea must carry only a compass," try to understand,
Any theory, authority, according to legend, the truth, and the standard, explain, imagination, knowledge... Is not in my eyes!
CodePudding user response: