| alph-num-sep-1.c - Et andet program der adskiller alfabetiske og numeriske afsnit i en tekst - læser fra stdin. | Lektion 10 - slide 21 : 28 Program 2 |
#include <stdio.h>
int main(void) {
char alph[25], numb[25];
int numres;
printf("Enter input, such as \"aaa111bbb222\"\n");
while (scanf("%[abcdefghijklmnopqrstuvwxyz]", alph) == 1){
numres = scanf("%[0123456789]", numb);
if (numres != 1)
printf("MISMATCH");
else
printf("Alphabetic: %s\n"
"Numeric: %s\n\n",
alph, numb);
}
return 0;
}