I'm a beginner in programming, and I'm currently working on C.
I'm trying to prompt the user for an input. The input I'm trying get is a block of text from them. But whenever a sentence is given, the program keeps prompting and the loop won't stop. What can I do to stop the loop once the text is inputted?
This is what I got so far:
#include <cs50.h>
#include <stdio.h>
#include <math.h>
#include <ctype.h>
#include <string.h>
int main(void)
{
//Prompt user for input
long p;
int s;
do
{
p = get_long ("Insert Text Here: ");
scanf("%li \n", &p);
p = (char) p;
}
while ((p < 'a' && p > 'Z') || (p < 'A' && p > 'Z'));
//Analyze The Grade Level
s = 0;
while (s < p)
{
s++;
printf ("s: %i \n", s);
}
printf ("\n");
}