home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
C Programming Starter Kit 2.0
/
SamsPublishing-CProgrammingStarterKit-v2.0-Win31.iso
/
tyc
/
list13_2.c
< prev
next >
Wrap
C/C++ Source or Header
|
1993-10-16
|
1KB
|
43 lines
/* Demonstrates the continue statement. */
#include <stdio.h>
main()
{
/* Declare a buffer for input and a counter variable. */
char buffer[81];
int ctr;
/* Input a line of text. */
puts("Enter a line of text:");
gets(buffer);
/* Go through the string, displaying only those */
/* characters that are not lowercase vowels. */
/* Note: in some printings of the book the following line */
/* erroneously read */
/* for (ctr = 0; buffer[ctr] !='0'; ctr++) */
/* The backslash was omitted before the zero. */
/* If you ran the program with this line you saw some very */
/* stange results! The following is correct. */
for (ctr = 0; buffer[ctr] !='\0'; ctr++)
{
/* If the character is a lowercase vowel, loop back */
/* without displaying it. */
if (buffer[ctr] == 'a' || buffer[ctr] == 'e' || buffer[ctr] == 'i'
|| buffer[ctr] == 'o' || buffer[ctr] == 'u')
continue;
/* If not a vowel, display it. */
putchar(buffer[ctr]);
}
}