Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include "pch.h"
- #include <iostream>
- #include <ctime>
- using namespace std;
- int main()
- {
- int tab[5];
- srand(time(NULL));
- for (int i = 0; i < 5; i++)
- {
- tab[i] = rand() % (50) + 1;
- for (int o = 0; o < i; o++)
- {
- while (tab[o] == tab[i])
- {
- tab[i] = rand() % (50) + 1;
- }
- }
- }
- cout << "Wylosowane liczby: " << endl;
- for (int i = 0; i < 5; i++)
- {
- cout << tab[i]<<endl;
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement