![]() |
Converting a word to lower case
I've got this program that compares two words. Later on it changes the case of a word from uppercase to lowercase. I saw someplace on the web where a guy was doing this:
:
He was including some header file called "strutils.h" and "genlib.h" I tried it in my program but my compiler says no way. Here is what I'm trying to do: :
int main()But I'm doing something wrong. I sense that it must be a pretty easy fix. I'll have to keep monkeying around with it. |
Decase your words a char at a time (loop on word length) using tolower () or toupper ().
|
:
string MyToLower (string source).... string lowerPiano = MyToLower(piano); |
or, more efficiently (no function call in the loop): ;)
:
... |
or, using the tools already provided by the standard:
:
#include <cctype> |
ooops, i should probably take the time to optimize the code in my lil' lib one day. :)
|
LOL, I don't really call it optimization. When I optimize, I put an analyzer on the thang and get a good profile. It just comes from being old and having to deal with 2K-256K of memory and a 1MHz-8MHz clock. One whittled as they went, and if it still didn't woik, they got serious and whittled some more. Mailpieces and such, moving at 100-400 inches per second, wait on no man to collect the data and decide when to divert their path.
|
| All times are GMT -5. The time now is 2:35 AM. |
Powered by vBulletin® Version 3.7.0, Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Copyright ©2007 DaniWeb® LLC