#include<stdio.h>
#include<string.h>
int main(){
int i;
char string[100],copy[100];
for(i=0;;i++){
printf("print your string: ");
scanf("%s",string);puts(string);
for(i=0;i<256;i++){
strcpy(copy,string);
if(copy[i] !='0' )
continue;
else if(copy[i]=='0')
printf("Invalid input!\n");
}
char z;
printf("do you want to continue? choose Yes or No ['Y'or'N']: ");
scanf("%c",&z);
if(z=='Y')
continue;
else if(z=='N')
break;
}
printf("Bye.\n");
return 0;
}
图片:
output:
print your string: 0lkvnn;dfu
0lkvnn;dfu
Invalid input!
Invalid input!
do you want to continue? choose Yes or No ['Y'or'N']: print your string: Y
Y
do you want to continue? choose Yes or No ['Y'or'N']: print your string: N
N
do you want to continue? choose Yes or No ['Y'or'N']: print your string:
(后面没往下打了)