U E D R , A S I H C RSS

데블스캠프2003/Toy Problems/Random

.

~cpp 
#include <iostream> //  iostream 포함 .
#include <ctime> // time(0)  .
using namespace std;

int main()
{
    srand(time(0)); // rand()  .
                    // 하  행할  . -_-;;
    int x = rand(); // rand()함  .
                    //    0 ~  .
    int x1 = rand() % 10; // % 10  x1  10    
                          // 0 ~ 9    .
    int x2 = rand() % 9 + 1; // % 9 0~8    
                            //  1  1~9   .
    return 0;
}


rand() % a + b b ~ a+b . ( 1da + b . )
b - ..=ㅂ=;;

Valid XHTML 1.0! Valid CSS! powered by MoniWiki
last modified 2021-02-07 05:28:56
Processing time 0.0142 sec