Skip to content

Instantly share code, notes, and snippets.

@ahoulgrave
Created April 24, 2013 13:47
Show Gist options
  • Save ahoulgrave/5452240 to your computer and use it in GitHub Desktop.
Save ahoulgrave/5452240 to your computer and use it in GitHub Desktop.
for y contador de arrobas de una cadena de texto
#include <cstdlib>
#include <iostream>
using namespace std;
int main(int argc, char *argv[])
{
char s_Str[150] = "Olmedo, l@a con@cha de @tu madre";
int n_Len = strlen(s_Str);
int arrobas = 0;
for (int i = 0; i < n_Len; i++) {
if (s_Str[i] != '@') {
printf("%c\n",s_Str[i]);
} else {
arrobas++;
}
}
printf("\nArrobas: %d\n\n",arrobas);
system("PAUSE");
return EXIT_SUCCESS;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment