Hi
very good question.Thanks because you want to build the base and then move forward.
OK.Remember that when you input sth through console it is saved as a string.the complier treats it as a string or array of characetrs.firstNumber's type is certainly double,right?So can you save characters in a variable of type double?NO you can't.
because of this you convert every block of this array to double.although you have enterd
numbers,the compiler thinks it is a string like "dog"(4 example).
note that if your input contains any character like "2154A" you will encounter an exception and program terminates showing you the line that caused exception and you should handle this line.If you don't know about exception handling,don't panic,you will learn in following chapters.
Hope it Helps
Erfan...
|