MeehoweCK

Untitled

May 27th, 2024
734
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.47 KB | None | 0 0
  1. #include <iostream>
  2. #include <ctime>
  3.  
  4. const int N{ 50 };
  5.  
  6. std::string wygeneruj(int dlugosc) {
  7.     std::string wynik{};
  8.     for (auto i{ 0 }; i < dlugosc; ++i) {
  9.         wynik += ('A' + rand() % 6);
  10.     }
  11.     return wynik;
  12. }
  13.  
  14. void wypiszWyrazy() {
  15.     int dlugosc;
  16.     std::cout << "Podaj dlugosc wyrazu: ";
  17.     std::cin >> dlugosc;
  18.     for (auto i{ 0 }; i < N; ++i) {
  19.         std::cout << wygeneruj(dlugosc) << std::endl;
  20.     }
  21. }
  22.  
  23. int main() {
  24.     srand(time(nullptr));
  25.     wypiszWyrazy();
  26.     return 0;
  27. }
Advertisement
Add Comment
Please, Sign In to add comment