Стили и методы программирования




Пример 10.2.5


#include

#include

#include

char symbol;

int cnt;

void main( void )

{

symbol = getchar ();

St1: if ('a'<=symbol && symbol <= 'z') {

printf ("%c", symbol);

cnt = 1;

symbol = getchar (); goto St2;

}

else if (symbol != '\n') {

symbol = getchar (); goto St1;

}

else /* (symbol == '\n') */ {symbol = getchar (); goto St3;};

St2: if ('a'<=symbol && symbol <= 'z') {

printf ("%c", symbol);

cnt++;

symbol = getchar (); goto St2;

}

else if (symbol != '\n') {

printf (" -%i\n", cnt);

symbol = getchar (); goto St1;

}

else {

printf (" -%i\n", cnt);

symbol = getchar (); goto St3;

};

St3: if ('a'<=symbol && symbol <= 'z') {

printf ("%c", symbol);

cnt = 1;

symbol = getchar (); goto St2;

}

else if (symbol != '\n') {

symbol = getchar (); goto St1;

}

else /* (symbol == '\n') */ return;

}




Содержание  Назад  Вперед