Skip to content

Instantly share code, notes, and snippets.

Created Apr 30, 2015
What would you like to do?
#include <iostream>
#include <string>
#include <cstdlib>
#include <algorithm>
#include <fstream>
using namespace std;
void check_banana (string banana){
ifstream AbrirBanana;;
string col;
int n = 0;
while(AbrirBanana.tellg() != -1){
AbrirBanana >> col;
for(int i = 0; i< col.size(); i++){
if( (col[i] == 'B' or col[i] == 'b') and
(col[i+1] == 'A' or col[i+1] == 'a') and
(col[i+2] == 'N' or col[i+2] == 'n') and
(col[i+3] == 'A' or col[i+3] == 'a') and
(col[i+4] == 'N' or col[i+4] == 'n') and
(col[i+5] == 'A' or col[i+5] == 'a') )
cout<<"La cantidad de veces que está escrita la palabra banana es: "<<n<<endl;
int main(){
return 0;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment