Hey can any one tell me please...
i input 4 digits in the input buffer... (1234) and read them as string
then i wasnt to split those number into individual digits.
after the compilation of the program and user input i get this output
where as i think it should be something like
so my problem is that...Convert.ToInt32(c); is not converting...and i am not getting error as well.
and when i change this type conversion line of code to
then i get the following error
please help me solve this tiny problem...thank you.
RentedLips
§ Rented Lips §
----------------
Begning To Learn
----------------
i input 4 digits in the input buffer... (1234) and read them as string
Code:
myString = Console.ReadLine();
Code:
int=input=0;char c;
for (int i = 0; i < myString.Length; i++)
{
c = myString[i];
input = Convert.ToInt32(c);
Console.WriteLine(input);
}
Code:
49
50
51
52
Code:
1
2
3
4
and when i change this type conversion line of code to
Code:
input = Int32.Parse(c);
Code:
Error 1 The best overloaded method match for 'int.Parse(string)' has some invalid arguments D:\My .NET Work\C #\Console\Dietel C Sharp\Chapter 4\Exercise 4.15\Exercise 4.15\Program.cs 30 25 Exercise 4.15
Error 2 Argument '1': cannot convert from 'char' to 'string' D:\My .NET Work\C #\Console\Dietel C Sharp\Chapter 4\Exercise 4.15\Exercise 4.15\Program.cs 30 37 Exercise 4.15
RentedLips
§ Rented Lips §
----------------
Begning To Learn
----------------