rnd() Funktion



  • Warum geht das nicht?

    short rnd(short a, short b)
    {
        return ((a + rand()) % (b – a + 1));
    }
    

    main.cpp:19: warning: comparison between signed and unsigned integer expressions
    main.cpp: In function short int rnd(short int, short int)': main.cpp:38: error: stray '\\150' in program main.cpp:38: error: expected)' before "a"
    main.cpp:38: error: expected `)' before ';' token
    Process terminated with status 1 (0 minutes, 0 seconds)

    MfG
    Stromberg

    EDIT: Okay, hat sich erledigt, des minus Zeichen ist kein Minus Zeichen, deshlab wird des hier auch so komisch angezeigt.


Anmelden zum Antworten