- ..clause 1..: Inputting error of fear
- ..clause 2..: Mistake of separator
- ..clause 3..: Too large numerical value
- ..clause 4..: Fear of character string
- ..clause 5..: About the solution
No do be known whether the author is a considerable sourpuss possibly either.
Though it introduces like the sample of a good program in the foregoing paragraph
It is hereafter because the complaint will be made when in the program, there is a problem.
On earth, where of the program ahead was the problem?
Actually, it is a problem to use the scanf function.
The scanf function is a function where it has various problems.
It is not used in real development in the introduction though it is used comparatively well.
The scanf function ban might been put out according to the company (school).
However, the program that had been made ahead operated especially without trouble.
On earth, the problem is where or ・・・・ and it are the inputting errors.
Though the scanf function doesn't especially cause the problem as long as it correctly uses it
At once, the dire problem might be caused when there is an inputting error.
It introduces the program like late in the future and it introduces the case with the inputting error to the theme.
As the example that seems to happen first of all, it must strike and it is necessary to make a mistake in the separator.
The following are the execution results for strike and make a mistake in the separator.
It input it to the start Though 100 was normally input
Delimit minimum value and the maximum value and input it. :100 200
100-307, Total.
Because this result is different depending on the compiler used
Another result might come out when you have them execute it.
Next, I want to input an extremely big numerical value.
Because a recent compiler can be input even by a considerably big numerical value
Use 16 bit compiler (LSI C-86) when you try this for myself.
The following are the execution results when a too large numerical value is input.
Though it is necessary to have input 70000 why It is recognized 4464.
Delimit minimum value and the maximum value and input it. :1,70000
1-4464, Total.
These are problems of happening because the limit within the range that can be memorized has been exceeded.
To the input variable to check the input With 4464 because it is substituted
It must strike, it is necessary to make a mistake in whether you wanted to put 4464, and Whether it became 4464 cannot be distinguished.
I want to experiment a heaven in addition dishonesty [oni].
That is, input the character string though it is said that input the numerical value.
The following are the execution results when the character string is input.
[Mecchakuchadesu] already. The author doesn't understand to have become it so why either.
Delimit minimum value and the maximum value and input it. :ABCDEF
11975-307, Total.
Though the person who surely violates [manuke] ..so.. might think that you are not ..you..
It might be half asleep, and a pet cat might trample down the keyboard.
In addition, the virus and the hacker occasionally input it unfortunately like this.
When such a situation happens because of the program used in the big enterprise and the government.
It is likely already to have become tired negligently being severely shown various inputting errors.
If the solution is not presented, you might be disgusted slowly, too.
However, the solution of this problem is not actually easy.
At least, this cannot be solved by your present knowledge.
The solution inputs as a character string, and the method of analyzing the data is general.
In a word, this problem to the solution though it is necessary to know the method of the string manipulation
The character string cannot be processed by your present knowledge.
It will introduce the means for solving the problems of this problem for a long time afterwards.
Till then, there is only keeping using the scanf function because there is no other way.
Meanwhile, take care about the inputting error earnestly.