I've been working on this program that should be simple for the last hour or so with no luck.
The question reads :
Write a function to read in a line of text (use getchar() routine) and display only the capital letters contained in the text. You can declare and use an array to store the text and a pointer to access the array.
What i've attemped so far is :
However DevC++ is telling me that theres a problem with the charPtr = getchar() part. I'm also at a loss how to keep the loop running when it comes across a non capital letter , i think the way mine is itll simply stop the loop so i'm trying to think of something to put in the else part thatll cause it to go through the loop again. I'm sure this is a really easy problem for most people but i am utterly rubbish at programming and cant figure it outCode:#include <stdio.h> #include <ctype.h> int main(){ char line_of_text[100], *charPtr; charPtr = line_of_text[0]; while (charPtr = getchar()); if ((charPtr >= 'A') && (CharPtr =< 'Z')) putchar();