Advertisement
Guest User

klari2

a guest
Mar 22nd, 2019
66
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.80 KB | None | 0 0
  1. #include <iostream>
  2. #include <fstream>
  3. #include <string.h>
  4.  
  5. using namespace std;
  6.  
  7. ifstream f("virag.be");
  8. int N,hsz,isz;
  9. char V[1000];
  10. char S[1000];
  11.  
  12. void Olvas()
  13. {
  14. f>>N;
  15. for(int i=0;i<=N-1;i++)
  16. {
  17. f>>V[i];
  18. if(V[i]=='H')
  19. hsz++;
  20. else
  21. isz++;
  22. }
  23. V[N]=0;
  24. cout<<V<<endl;
  25. }
  26.  
  27. void Epit()
  28. {
  29. int p=0;
  30. for(int i=1;p<N;i++)
  31. {
  32. for(int j=1;j<=i && p<N;j++)
  33. { S[p]='I';
  34. p++;
  35. }
  36. if(p<N)
  37. {
  38. S[p]='H';
  39. p++;
  40. }
  41. }
  42. S[N]=0;
  43. cout<<S<<endl;
  44. }
  45.  
  46. int main()
  47. {
  48. Olvas();
  49. Epit();
  50. cout<<isz<<endl;
  51. cout<<hsz<<endl;
  52. if(strcmp(S,V)==0)
  53. cout<<"Igen";
  54. else
  55. cout<<"Nem";
  56. return 0;
  57. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement