Untitled

 avatar
unknown
c_cpp
a year ago
443 B
4
Indexable
#include <iostream>
#include <cstdlib>
#include <ctime>

int randomNumber( int from, int to )
{
    return from + rand() % ( to - from + 1 );
}

int main()
{
    srand( time( 0 ) );

    int from = 10;
    int to = 155;

    std::cout << "Losujemy liczby z zakreus [ " << from << ", " << to << " ]\n";
    for( int i = 0; i < 5; ++i )
    {
        std::cout << randomNumber( from, to ) << ", ";
    }

    return 0;
}
Editor is loading...
Leave a Comment