GIDForums  

Go Back   GIDForums > Computer Programming Forums > C Programming Language
User Name
Password
Register FAQ Members List Calendar Search Today's Posts Mark Forums Read

 
 
Thread Tools Search this Thread Rate Thread
  #1  
Old 20-Mar-2005, 10:56
AnnetteB AnnetteB is offline
New Member
 
Join Date: Mar 2005
Posts: 6
AnnetteB is on a distinguished road

Checking Capital Letters against Lower Case


I have worked out how to check if a word is the same frontwards and backwards, I now need to check if they are capital letters or lower case letters - can anyone throw any light on the if statement I would need - currently for checking the letters backwards and forwards I have:

CPP / C++ / C Code:
int Front;
int Back;
bool Palindrome;

Line = ReadStringPr ("Enter string to test: ");
Front = 1;
Back = Length(Line);
Palindrome = true;

while ((Front < Back) && (Palindrome == true))
{
if (Line[Front] != Line[Back])
  Palindrome = false;
Front = Front + 1;
Back = Back - ;
}
WriteString (Line);

It is the condition that I think needs changing but I am not sure where to start?

Any help would be appreciated.

Thanks.

Annette
Last edited by LuciWiz : 20-Mar-2005 at 11:03. Reason: Please insert your C code between [c] & [/c] tags
  #2  
Old 20-Mar-2005, 12:47
WaltP's Avatar
WaltP WaltP is offline
Outstanding Member
 
Join Date: Feb 2004
Location: Midwest US
Posts: 3,335
WaltP is a name known to allWaltP is a name known to allWaltP is a name known to allWaltP is a name known to allWaltP is a name known to allWaltP is a name known to all
Look into the functions toupper() and/or tolower(). Therein lies your solution.

Also, you might want to start using code tags. You have been asked to do so 3 times so far.
__________________

During the election they said Obama could only be elected when pigs fly. Well, we currently have an epidemic of Swine Flu. Coincidence?
 
 

Recent GIDBlogOnce again, no time for hobbies by crystalattice

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Compiling Errors ToddSAFM C++ Forum 22 18-Dec-2004 12:42
Problems with switch statement dontcare C++ Forum 4 29-Nov-2004 19:28
fltk-2.0 cvs Plumb FLTK Forum 20 13-Nov-2004 08:10
there has to be a better way dabigmooish C++ Forum 8 17-May-2004 11:24
C++ file I/O CronoX C++ Forum 36 09-Mar-2004 18:28

Network Sites: GIDNetwork · GIDWebHosts · GIDSearch · Learning Journal by J de Silva, The

All times are GMT -6. The time now is 21:14.


vBulletin, Copyright © 2000 - 2009, Jelsoft Enterprises Ltd.