I have input a string and I want to convert each element into an integer and store it individually in an array.For instance I input 123 as a string,i want to store it in array nums.The first index(nums[0]) should have 1 the second(nums[1])should have 2 and so on.Now here is what i`ve done(which is not working):
;Code:str=Console.ReadLine(); for(int 1=0;i<3;i++) { nums[i]=int.Parse(str[i]); }
The error is that it cannot convert the first argument form a char to a string and ther are some invalid arguments.
I`m perplexed,anyone???




Reply With Quote