《c程序设计语言》读书笔记-3-3-速记扩充
#include <io.h> #include <stdio.h> #include <string.h> #include <stdlib.h> int main() { char c; int i,j; char str1[] = "ABCDa-z0-9",str2[50]; i = j = 0; while((c = str1[i++]) != '\0') if(str1[i] == '-' && str1[i + 1] >= c) { i++; while(c < str1[i]) str2[j++] = c++; } else str2[j++] = c; str2[j] = '\0'; for(i = 0;i < j;i++) printf("%c ",str2[i]); return 0; }