Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include <cstdlib>
- using namespace std;
- int main(){
- const int tam=50;
- char frase[tam];
- char caracter;
- int iguales=0;
- cout<<"caracter: ";
- cin>>caracter;
- cin.ignore();
- cout<<"ingrese un frase: ";
- cin.getline(frase, tam);
- for (int i = 0; i < tam; i++){
- if (frase[i]==caracter){
- iguales++;
- }
- }
- cout<<iguales;
- cout<<endl;
- system("pause");
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment