#include
#include
void main() {
int k;
char s[] = "ABCCDA", c;
for (k = 1;(c = s[k]) != '\0';k++) {
switch (c) {
case'A':putcahr('%');continue;
case'B':++k;break;
default:putchar('*');
case'C':putchar('&');continue;
}
putchar('#');
}
system("pause");
}
幫你修改了代碼,應該沒問題了,望采納。
#include<stdio.h>
#include<windows.h>
int main() {
int k;
char s[] = "ABCCDA", c;
for (k = 1;(c = s[k]) != '\0';k++) {
switch (c) {
case'A':putchar('%');continue;
case'B':++k;break;
default:putchar('*');
case'C':putchar('&');continue;
}
putchar('#');
}
system("pause");
}