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

From AdonaiMedrado.Pro.Br
Revision as of 16:33, 3 April 2009 by 200.17.147.2 (Talk) (New page: <code lang="c"> #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...)

(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
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);
}