Solution for Exercise 17-7
ex1707
#include <stdio.h>
#include <ctype.h>
int main()
{
char input[64];
char ch;
int x = 0;
printf("Type in some text: ");
fgets(input,63,stdin);
while(input[x] != '\n')
{
if(isalpha(input[x]))
ch = input[x] & 223;
else
ch = input[x];
putchar(ch);
x++;
}
putchar('\n');
return(0);
}
Notes
* For my solution, I took refuge in the function isalpha() in Line 15. That test returns TRUE whenever a letter of the alphabet is encountered, FALSE otherwise.
* Remember that you need to include the ctype.h header file when you use the isalpha() function.
Copyright © 1997-2025 by QPBC.
All rights reserved
