C# equivalent to Javas scn.nextInt( )

53

C# equivalent to Java's scn.nextInt( ) -

static int GetInt() {
        int integer = 0;
        int n = Console.Read();
        while (n == ' ' || n == '\n' || n == '\r' || n == '\t' || n == -1)
            n = Console.Read();
        while (n >= '0' && n <= '9') {
            integer = integer * 10 + n - '0';
            n = Console.Read();
        }
        return integer;
    }

Comments

Submit
0 Comments