I got this code.. now the challenging part is my prof asked me to make a program which asks the user to input an uppercased word.
The problem is, she wants the program to automatically transform each inputted letter in uppercase even if the user's keyboard is not in capslock mode.. so i don't know what's really wrong with my program... anyone?? help?? i really need it.. thanks..
#include<stdio.h>
#include<ctype.h>
#include<string.h>
typedef char String[100];
main()
{
char Resp;
int l, x = 0, asc = 13;
String s, word1;
clrscr();
do {
printf("\n1st uppercased word: ");
do {
s[0] = getch();
word1[x++] = s[0];
strupr(s);
strcat(s, "\0");
puts(s);
} while (s[0] != (char) asc);
strcat(word1, "\0");
printf("\n\n1st word in lowercase: ");
for (l = 0; l < strlen(word1); l++)
putchar(tolower(word1[l]));
printf("\nDo you want to continue?[Y/N]: ");
Resp = getche();
} while (toupper(Resp) == 'Y');
getch();
return 0;
}