Advertisement
Guest User

Untitled

a guest
Feb 21st, 2018
65
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.34 KB | None | 0 0
  1. #include <iostream>
  2. #include <string.h>
  3. using namespace std;
  4. int numar(char *s, char c)
  5. {int n=0; s=strchr(s,c);
  6. while (s){n++; s=strchr(s+1,c);}
  7. return n;}
  8. int main()
  9. {char sir[256], c; cout<<"sirul: "; cin.get(sir,255);
  10. cout<<"caracterul: "; cin>>c;
  11. cout<<"caracterul "<<c<<" apare in sirul "<<sir;
  12. cout<<" de "<<numar(sir,c)<<" ori";}
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement