String to uppercase

I'm trying to output a string to a file twice, the first time it needs to be exactly as input the first time but then the first character needs to be changed to uppercase for the second time.

Its very simple but I can't find a way to do it using the string functions. The problem is that I can't access the std namespace so I need to do it using another way.
You van use the toupper() function to convert each letter from the string
http://www.cplusplus.com/reference/clibrary/cctype/toupper.html
Last edited on
nice thanks.

Edit: Ok it was working but when I tried to use it in this member function it didn't do anything. I'm just completely out of ideas, as soon as I've figured out how to get it working I'll need to copy out the rest of the name.
Here's the code:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
void Tech::display(ostream&o) {
	
	o << "short " << name << "(short s) {" << endl			
	  << "char name[] = \""

         // This is where the problem lies
	  << toupper(name[0]) << "\";" << endl

	  << "short type = eleVoid;" << endl
	  << "const short comboMax = " << comboMAX << ";" << endl
	  << "const short comboMin = " << comboMIN << ";" << endl
	  << "short attLvl = " << attLvl << ";" << endl
	  << "short baseLvl = 1;" << endl << endl
	  << "short dmg = damageCalc(s,attLvl);" << endl
	  << "return dmg;" << endl;
}


Not exactly sure why's its gone all wrong, the output file just gives me numbers where the capital letters meant to be.

Also is there a way to copy the last letters of the name to a second string without using the std namespace or string objects since i have neither.
Last edited on
Topic archived. No new replies allowed.