Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include<iostream>
- #include<string.h>
- #include<stdio.h>
- using namespace std;
- char s[256],c;
- int i,j;
- int main()
- {
- cout<<"Introduceti sirul = ";cin.getline(s,256);
- cout<<"Introduceti caracterul cautat = ";c=getchar();
- j=0;
- if(c=='\n') c=' ';
- for(i=1;i<=strlen(s);i++)
- {
- if(s[i-1]==c)
- j++;
- }
- cout<<"Caracterul exista in sir de "<<j<<" d ori "<<endl;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement