Question
Directions: Please complete the following assignment to signify your completion of Unit 11. All programming projects need to be completed and submitted electronically, following the
Directions:
Please complete the following assignment to signify your completion of Unit 11. All programming projects need to be completed and submitted electronically, following the Electronic Submission Guidelines discussed in class. Please cherry-pick from your solution folder and submit just the .c files you created as well as the executable file created by your development environment.
Background:
The purpose of this assignment is to get practice working with strings. For this assignment, I'll be giving you some starter code. It sets up an string universe which will let you focus on working with strings and string parameters. From a C point of view, a string is just an array of characters. So working with strings seems very much like looping with an array.
Project 6: String Programming Given the following starter code:
#include/* function declarations - CS 50 Students need to implement this function */ /* from the string argument, it should return one of the following: */ /* 0 - name looks good!, as in "Howard Stahl" */ /* 1 - name has numbers in its value, as in "How123 Sta12" */ /* 2 - name has non-capitalized letters after a space, as in */ /* "howard stahl" */ /* 3 - name has non-capitalized letter as the first letter, as */ /* in "howard Stahl" */ /* 4 - name has non-alphanumeric characters, as in "#$5 Stahl" */ int validateName( char arr[] ); int main ( int argc, char ** argv ) { /* use the data found in argv to validateName */ /* don't go beyond the number of elements found in argc */ int value; value = validateName( /* supply a variable here... */ ); switch( value ) { case 0: printf( "name passed all validation rules! " ); break; case 1: printf( "name has numbers, not only letters... " ); break; case 2: printf( "name has a letter following a space that is not capitalized... " ); break; case 3: printf( "name value does not start with a capital letter... " ); break; case 4: printf( "name has non-alphanumberic characters... " ); break; } return 0; }
Please complete the declared function that have been stubbed out. By doing so, you will be working with strings and string arguments. I have supplied some sample output to help you understand the kind of code I am looking for.
SAMPLE RUN
Please enter your name: Howard Stahl name passed all validation rules! Please enter your name: 124%%$ 1347DD name has numbers, not only letters... Please enter your name: howard stahl name does not start with a capital letter... Please enter your name: (*&)_#$% name has non-alphanumeric characters...
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started