Solução: Problema da freqüência do caractere (Rafael Oliveira)

From AdonaiMedrado.Pro.Br
Revision as of 16:50, 3 April 2009 by 200.17.147.2 (Talk)

Jump to: navigation, search
#include <stdio.h>
#include <string.h>
 
int main(int argc, char *argv[])
{
    char S1[100],S2[100],C;
    int i,cont=0;
    strcpy(S1,argv[1]); 
    strcpy(S2,S1);
    C=argv[2][0];
    for(i=0;i<100;i++)
        if(S1[i]==C)
        {
            cont++;
            S2[i]='*';
        }
    printf("%d\n %s\n", cont,S2);
}