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

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

(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[101],s2[101],c;
    int i,cont=0;
    if (argc!=3)
        printf("Informacao insuficiente");
    else
    {
    strcpy(s1,argv[1]); 
    strcpy(s2,s1);
    C=argv[2][0];
    for(i=0;i<strlen(s1);i++)
        if(s1[i]==c)
        {
            cont++;
            s2[i]='*';
        }
    printf("%d\n %s\n", cont,s2);
    }
}