Question: Modify the project below: #include #include / / Author: Nhu Phan / / This program checks the validity of user input based on specific conditions.
Modify the project below:
#include
#include
Author: Nhu Phan
This program checks the validity of user input based on specific conditions.
The input is valid if all alphabetic letters are lowercase, and nonalphabetic letters are limited to digits, whitespace, exclamation point, question mark, or period.
int main
Declare variables
char ch;
int isvalid; Flag to track the validity of the input
Prompt user for input
printfEnter input: ;
Read characters until a newline character is encountered
whilechgetchar
Check if the character follows the specified conditions
if islowerch isdigitch isspacech ch ch ch
isvalid ;
Print the results based on the validity of the input
if isvalid
printfvalid;
else
printfinvalid;
return ;
Requirements
Name your program projectvalid.c
Input characters are command line argument.
Character handling library functions in ctype.h are allowed.
The program should also check if the number of arguments on the command line is greater than including aout as one of the arguments If the number of arguments is not greater than the program should print "invalid number of arguments".
Follow the format of the examples below.
Examples your program must follow this format precisely
Example #
$ aout spring
invalid
Example #
$ aout little pigs!
valid
Example #
$ aout
invalid number of arguments
Example #
$ aout Computer Science?
invalid
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
