Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include <cstdlib>
- #include <ctime>
- int wylosuj( int start, int stop )
- {
- return rand()%( ( stop - start ) + 1 ) + start;
- }
- int main()
- {
- srand( time( NULL ) );
- int liczby[ 999 ];
- int licznik = 0, suma = 0;
- do
- {
- liczby[ licznik ] = wylosuj( 4, 10 );
- std::cout << "Element o indeksie " << licznik << " : " << liczby[ licznik ] << std::endl;
- suma += liczby[ licznik ];
- licznik++;
- } while( licznik <= 999 );
- std::cout << "Suma to: " << suma << std::endl;
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment