Example #1
0
/*
 * chop the string in two and send the parts away
 */
void chopandspit(char *str)
{
int i, dot;
char *ip, *fp;

	for(i=0; i<strlen(str)&&str[i]!='.'; i++);

	dot=i;
	ip=(char *)malloc((dot+1)*sizeof(char));
	fp=(char *)malloc((strlen(str)-dot+1)*sizeof(char));

	for(i=0; i<dot; i++)
	{
		ip[i]=str[i];
	}
	ip[i]=0;

	for(i=dot+1; i<strlen(str)+1; i++)
	{
		fp[i-dot-1]=str[i];
	}
	fp[i-dot]=0;

	dollars(ip);
	cents(fp);

	free(fp);
	free(ip);
}
Example #2
0
int main(void)
{
	char src[100];
	scanf("%s",src);
	dollars();

	return 0;
}
Example #3
0
int main(void) {
    char src[100];
    char dst[100];
    while(gets(src)) {
        dollars(dst, src);
        printf("src is :%s\t%s\n", src, dst);
    }
}
Example #4
0
int main(void)
{
	int in, a;
	scanf("%d", &in);
	char *src = itoa(in);
	char *dest = malloc(NUMSIZE);
	//printf("%s\n", p);
	dollars(dest, src);
	printf("%s\n", dest);
	
	free(src);
	free(dest);

	return 0;
}