Hi,

This is my first time programming with c++, so please bear with me.

I have a string variable that needs to be converted into lower case or upper case. I want to use the tolower() or toupper() functions in the C string.

I have a problem changing the string into a character array.

This is my code:

#include <iostream>
#include <string>
#include <ctype.h>
using namespace std;

int main( int argc, char *argv[] ) {
string strMyString;
string strNewString;

cin >> strMyString; //pass in string to be changed

char tmpChar[strMyString.length()];
tmpChar = strMyString.c_str();

for (int i = 0; i<strlen(tempChar); i++)
{ strNewString += tolower(tmpChar[i]);
}

cout << strNewString << endl;
}


i have a problem with assigning the character array tempChar to strMyString.c_str();

does anyone have any ideas?

thanks a lot!!