+ 1

Can you help ? What is there wrong?

https://code.sololearn.com/cg5S9E2zgyAC/?ref=app

17th Feb 2018, 9:27 PM
Tiran Araqelyan
Tiran Araqelyan - avatar
13 Answers
+ 2
Yes you can. https://code.sololearn.com/ce9xvKovazSN I did almost nothing to your metod. Just added a foreach- loop in Main method and the code is working. ok and removed some of my debug-statements ok (0 < j) should be (0 <= j)
19th Feb 2018, 9:00 PM
sneeze
sneeze - avatar
+ 2
I like to help you but you need to answer my question. Is "54.97.94.64" valid input ?
19th Feb 2018, 1:42 PM
sneeze
sneeze - avatar
+ 2
Thanks. Read my comments below. Change this line : foreach (var word in ipv4) ipv4 is the orginal not splitted string, this foreach loop loops through every single character of the string to : foreach (var word in words) Change this line : if (word.GetType() == typeof(int) && (0 < i) && (i < 256)) to : i.GetType() == typeof(int) && (0 < i) && (i < 256)) word is of type var, but when initialized in the " foreach (var word in words)" words is of type string[] so word is a string Ultimately change the line to this int j; if (int.TryParse(word, out j) && (0 < i) && (i < 256)) // but you are looking for this TryParse tries to convert the first parameter to a int. If it does not succeed TryParse returns false. If true the converted value is set in the second parameter ("j") https://www.dotnetperls.com/parse https://code.sololearn.com/cAMBE9btPL5B You did a good job, just made some beginner mistakes.
19th Feb 2018, 8:25 PM
sneeze
sneeze - avatar
+ 2
thenk you ,you help my much.
19th Feb 2018, 8:36 PM
Tiran Araqelyan
Tiran Araqelyan - avatar
+ 1
int i=Convert.Toint(word ); should be int i=Convert.ToInt32(word ); And I did comment out Console.ReadKey(); Because you do not need it in the playground.
17th Feb 2018, 10:14 PM
sneeze
sneeze - avatar
+ 1
Metod returns the value false so the output that is printed is false Please elaborate more what is the output you expected ?
18th Feb 2018, 10:10 AM
sneeze
sneeze - avatar
19th Feb 2018, 11:53 AM
Tiran Araqelyan
Tiran Araqelyan - avatar
+ 1
yes
19th Feb 2018, 1:45 PM
Tiran Araqelyan
Tiran Araqelyan - avatar
+ 1
your are welcome
19th Feb 2018, 8:36 PM
sneeze
sneeze - avatar
19th Feb 2018, 8:40 PM
Tiran Araqelyan
Tiran Araqelyan - avatar
0
I chenged but no result.
18th Feb 2018, 4:23 AM
Tiran Araqelyan
Tiran Araqelyan - avatar
0
Should the code return True ? Are you getting "No output" as result ?
18th Feb 2018, 8:14 AM
sneeze
sneeze - avatar
0
No,i get false.
18th Feb 2018, 9:41 AM
Tiran Araqelyan
Tiran Araqelyan - avatar