I'm trying to create a program in C++ where it will turn whatever sentence you input into
-all caps
-all lowercase
-capitalized letters will be switched with lowercase & vice versa
I've written everything up correctly so far, the only part I can't figure out is how to get it to give me back the three individual responses. If I only have one function within the while loop it works fine, but not with all three & I don't know how to get around that. Thanks!
Here's my code:
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <ctype.h>
void allCaps(char ch);
void allLows(char ch);
void mixed(char ch);
char ch;
int main()
{
printf("Enter Sentence:\n");
while((ch=getchar()) != '\n')
{
allCaps(ch);
printf("%c",ch,"\n");
allLows(ch);
printf("%c",ch,"\n");
mixed(ch);
printf("%c",ch,"\n");
}
return ch;
}
void allCaps(char ch)
{
if(ch >= 'a' && ch <='z')
::ch=ch-32;
}
void allLows(char ch)
{
if(ch>='A'&&ch<='Z')
::ch=ch+32;
}
void mixed(char ch)
{
if(ch >= 'a' && ch <='z')
::ch=ch-32;
else if(ch>='A'&&ch<='Z')
::ch=ch+32;
}