View Single Post
Old Jun 7th, 2007, 1:03 AM   #1
357mag
Hobbyist Programmer
 
Join Date: Mar 2005
Posts: 148
Rep Power: 4 357mag is on a distinguished road
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:

string lowerOrangeFruit = ConvertToLowerCase(orangeFruit)

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()
{
	string guitar = "guitar"; // g has an ASCII code of 103
	string piano = "Piano"; // P has an ASCII code of 80

	cout << "Does " << guitar << " come before " << piano << "?" << endl << endl;

	if (guitar < piano)
		cout << "Yes!";

	else
	    cout << "No!";

	string lowerPiano = string.tolower(piano);

	return 0;
}

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.
357mag is offline   Reply With Quote