Well, first up, here's your code as posted above. I've simply changed the layout to maye it easier to read. I've included the input and output at the end.
Code:
#include <stdio.h>
#include <ctype.h>
void makeCap(void)
{
char inChar;
printf("Please type a sentence: \n");
while ((inChar = getchar()) != 'q')
{
if (islower(inChar)) putchar(toupper(inChar));
}
}
int main(void)
{
makeCap();
return(0);
}
/*
Program output:
Please type a sentence:
After 4 words, please quit reading
FTERWORDSPLEASE
*/
Here's a slightly modified program:
Code:
#include <stdio.h>
#include <ctype.h>
void makeCap(void)
{
char inChar;
printf("Please type a sentence: \n");
while ((inChar = getchar()) != 'q')
{
inChar = toupper(inChar);
putchar (inChar);
}
}
int main(void)
{
makeCap();
return(0);
}
/*
output:
Please type a sentence:
After 4 words, please quit reading
AFTER 4 WORDS, PLEASE
*/