Exemple #1
0
int main(void)
{
    char line[LIMIT];

    puts("Please enter a line:");
    gets(line);
    ToUpper(line);
    puts(line);
    printf("That line has %d punctuation characters.\n",
           PunctCount(line));

    return 0;
}
Exemple #2
0
int main(void)
{
	char line[LIMIT];
	char * find;

	puts("Please enter a line:");
	fgets(line, LIMIT, stdin);
	find = strchr(line, '\n');  // 查找换行符

	if (find)
		*find = '\0';   // 用空字符替换
	ToUpper(line);
	puts(line);
	printf("That line has %d punctuation characters.\n", PunctCount(line));

	return 0;
}
Exemple #3
0
int main(void)
{
    char line[LIMIT];
    char * find;
    
    puts("Please enter a line:");
    fgets(line, LIMIT, stdin);
    find = strchr(line, '\n');   // look for newline
    if (find)                    // if the address is not NULL,
        *find = '\0';            // place a null character there
    ToUpper(line);
    puts(line);
    printf("That line has %d punctuation characters.\n",
           PunctCount(line));
    
    return 0;
}