Advertisement
palenda21

Lab7A12

Dec 5th, 2019
126
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.37 KB | None | 0 0
  1. #include <iostream>
  2. #include <string.h>
  3.  
  4. using namespace std;
  5.  
  6. int main()
  7. {
  8.     char st[100];
  9.     int k=0,i=0;
  10.     cout<<"Vvedite stroky: ";
  11.     cin.getline(st, 100);
  12.     for(i=strlen(st);i>-1;i--)
  13.     {
  14.         if (st[i]==' ')
  15.             if(st[--i]=='g')
  16.             k++;
  17.         }
  18.     cout<<"Kolichestvo slov s 'g' in the end :" <<k<<endl;
  19.     return 0;
  20. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement