Advertisement
Guest User

Untitled

a guest
Oct 19th, 2019
75
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.10 KB | None | 0 0
  1. #include <iostream>
  2.  
  3. using namespace std;
  4.  
  5. int main()
  6. {
  7. int i, w;
  8. i=0;
  9. n=0;
  10. //cout << "podaj ilosc liter" << endl;
  11. //cin>> n;
  12.  
  13. char litery[200];
  14. char ilosc[8]
  15. cout << "podaj wyraz" << endl;
  16. cin >> litery;
  17. //cout << litery[n-1] << endl;
  18. for (i=0;i<sizeof(litery)/sizeof(char) ;i++)
  19. {
  20. if( litery[i]=='a' )
  21. {
  22. ilosc[0]= ilosc[0]+1;
  23.  
  24. }
  25. if( litery[i]=='k' )
  26. {
  27. ilosc[1]= ilosc[1]+1;
  28.  
  29. }
  30. if( litery[i]=='l' )
  31. {
  32. ilosc[2]= ilosc[2]+1;
  33.  
  34. }
  35. if( litery[i]=='m' )
  36. {
  37. ilosc[3]= ilosc[3]+1;
  38.  
  39. }
  40. if( litery[i]=='o' )
  41. {
  42. ilosc[4]= ilosc[4]+1;
  43.  
  44. }
  45. if( litery[i]=='p' )
  46. {
  47. ilosc[5]= ilosc[5]+1;
  48.  
  49. }
  50. if( litery[i]=='s' )
  51. {
  52. ilosc[6]= ilosc[6]+1;
  53.  
  54. }
  55. if( litery[i]=='t' )
  56. {
  57. ilosc[7]= ilosc[7]+1;
  58.  
  59. }
  60.  
  61. }
  62. cout<<ilosc<<endl;
  63.  
  64. return 0;
  65. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement