Advertisement
Dawid_PAr

Cpp

Aug 6th, 2019
117
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.22 KB | None | 0 0
  1. #include <iostream>
  2. #include <string>
  3. #include <fstream>
  4. #include <conio.h>
  5. #include <algorithm>
  6. #include <ctime>
  7. #include <cstdlib>
  8.  
  9. using namespace std;
  10. int main()
  11. {
  12.  
  13. srand(time(NULL));
  14. int liczba;
  15. int j = 0;
  16. string znaki= "";
  17. string litera = "P";
  18. for(int i = 0; i < 10; i++)
  19. {
  20. cout << endl;
  21. for (int j = 0; j < 10; j++)
  22. {
  23. liczba = rand()%101+0;
  24. if(liczba+17 == 77)
  25. {
  26. znaki += "@";
  27. cout << "@ ";
  28. }
  29. else
  30. {
  31. if(liczba%2 == 1)
  32. {
  33. znaki += "*";
  34. cout << "* ";
  35. }
  36. else if(liczba%2 == 0)
  37. {
  38. znaki+="#";
  39. cout << "# ";
  40. }
  41. }
  42. }
  43. }
  44.  
  45. liczba = rand()%101+0;
  46. cout << endl << endl << endl;
  47. for(int i = 0; i < 10; i++)
  48. {
  49. cout << endl;
  50. for(int k = 0; k < 10; k++)
  51. {
  52. if(j == liczba)
  53. {
  54. znaki[j] = litera[0];
  55. }
  56. cout << znaki[j] << " ";
  57. j+=1;
  58. }
  59. }
  60. return 0;
  61. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement