View Code of Problem 50

#include <stdio.h>
#include <stdlib.h>
int main()
{
	int i,j;
    char str1[80],str2[80];
    gets(str1);
    for(i=j=0;str1[i];i++)
    {
    if((str1[i]<'0'||str1[i]>'9')&&(str1[i+1]>='0'&&str1[i+1]<='9'))
    {
    str2[j]='*';
    j++;
    }
    if((str1[i]<'0'||str1[i]>'9')&&str1[i+1]==0)
    {
    str2[j]='*';
    j++;
    str2[j+1]='\0';
    break;
    }
    if(str1[i]>='0'&&str1[i]<='9')
    {
    str2[j]=str1[i];
    j++;
    }
    }
    puts(str2);
	system("pause");
	return 0;
}

Double click to view unformatted code.


Back to problem 50