I am trying to create a program that a common error that users often make is that they forget the caps locks on an print text like this: "tHIS IS A SAMPLE of an error", this usually happens at the beginning of a new sentence. Write a program to detect this error and fix it. The input will be a long string on keyboard. Basically I am trying to change: "tHIS IS A SAMPLE of an error" to "This is a simple of an error." The only error I got is "isalpha"
#include <stdio.h>
#include <string.h>
main()
{
char sent [30];
int length=0, i=0, capCount=0, endLoop=0;
printf ("Enter sentence up to 30 characters:\n" );
Format -> Change Case in Word (XP has it, and probably 2000 and eariler as well). Convert to lowercase, and then convert to Sentence case.
The reason that you convert to lowercase first is because Word thinks that all-caps words are supposed to be that way (probably for acronyms and such), except in the case of a complete UPPERCASE sentence. After converting to lowercase, Sentence case will then put it the way you want.
Edit: Unless you're doing this for the cause of "let's make a random program", then more power to you. Now that I look at it, it's probably that, since you're not really reading a text file in, bah.
Code:
Also, there are code tags that could help you with indenting..