Hi, i am currently trying to write a program that can accept 3 input strings and perform different tasks based upon it. I currently have written a program that will scan what the user inputs and display how many characters have been inputted and also the amount of spaces to differientiate between strings. I have also set a limit to stop reading the input after 64 characters.
The main problem I am facing is to differientiate one string from another as the program is meant to display a message saying that the input is too long if one of the strings has more than 30 characters.
This program also needs to identify if the third letter of each string is upper case or lower case and then depending on what it is change the entire word to that case.
I know i must use isupper / islower and toupper/tolower but not sure how to correctly implement this into my program.
Atm the this is what i have:
Code:
#include<stdio.h>
#include<ctype.h>
#include<string.h>
int main(void)
{
char string_input[65] = { '\0' };
char character;
int count, space;
if ( scanf( "%64c", string_input ) > 0 )
{
printf( "The Length of your input is %d \n", strlen (string_input) );
space = 0;
for ( count = 0; count < strlen( string_input ); count++)
{ character = string_input[ count ];
if (isspace ( character ) )
space++;
}
printf( "Your input found %d spaces \n", space );
}
}
I know it seems a lot to ask but any pointers would be greatly appreciated.