开发者

I'm not typing something right

开发者 https://www.devze.com 2023-02-05 22:13 出处:网络
return Convert.ToInt32(myClass2.Digit(bmp, nX1, nY1) + myClass2.Digit(bmp, nX开发者_C百科2, nY2) + myClass2.Digit(bmp, nX3, nY3)
return Convert.ToInt32(myClass2.Digit(bmp, nX1, nY1)
                                 + myClass2.Digit(bmp, nX开发者_C百科2, nY2)
                                 + myClass2.Digit(bmp, nX3, nY3)
                                 + myClass2.Digit(bmp, nX4, nY4)
                                 + myClass2.Digit(bmp, nX5, nY5));

...finds this test method:

class Class2 {
    public string Digit(Bitmap bmp, int x, int y) {
//Please drop any logic using bmp, x, and y for the sake of this post.  Let's just...
        return "3";
    }
}

and returns 33333 as an int. As a preliminary to get something going so far, so good.

The problem comes when I want to return "0"; there's literally no output, not even an 0 much less an 00000. Instead, a line isn't even written to the console.

Thanks for any help.


If you want leading zeros use this:

Console.WriteLine(String.Format("00000", someInteger));


Solved. My code as originally posted proved in the final analysis to be fine. Question is moot.

0

精彩评论

暂无评论...
验证码 换一张
取 消