Advertisement
Guest User

Untitled

a guest
Mar 31st, 2020
160
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.64 KB | None | 0 0
  1. #include <iostream>
  2. #include <conio.h>
  3. #include <cstring>
  4. #include <cstdio>
  5. #include <cstdlib>
  6. #include <ctime>
  7.  
  8. using namespace std;
  9.  
  10. string slowa[4] = {"dupa", "cipa", "chuj", "faddoo"};
  11.  
  12. int main()
  13. {
  14. int a, i, b;
  15.  
  16. srand(time(NULL));
  17.  
  18. int liczba = rand() %4+1;
  19. string s = slowa[liczba];
  20. int n = s.length();
  21. char char_array[n + 1];
  22. strcpy(char_array, s.c_str());
  23.  
  24. cout << s;
  25. cout << "Podaj litere";
  26. cin >> a;
  27.  
  28. for(i=1; i<2; i++)
  29. {
  30. if(a=char_array[1])
  31. cout << char_array[1];
  32. else
  33. cout << "_";
  34. }
  35.  
  36. return 0;
  37.  
  38.  
  39. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement