c语言判断一个字符串不能全是星号
#include <stdio.h>
#include <string.h>
int main() {
char str[100];
int len, i, count = 0;
printf("请输入一个字符串:");
scanf("%s", str);
len = strlen(str);
for (i = 0; i < len; i++) {
if (str[i] != '*') {
count++;
}
}
if (count == 0) {
printf("字符串不能全是星号。\n");
} else {
printf("字符串不全是星号。\n");
}
return 0;
}
原文地址: http://www.cveoy.top/t/topic/fddr 著作权归作者所有。请勿转载和采集!