Ask your own question, for FREE!
Computer Science 14 Online
OpenStudy (anonymous):

how would you change all the character of a string to uppercase in c++

OpenStudy (anonymous):

Create a lookup table with 26 positions indexed by the ASCII value of the character to be changed. The value in the lookup table at a particular location is the upper case ASCII value.

OpenStudy (rsmith6559):

int i = 0; while( string[i] ) { if( string[i] >= 'a' ) && ( string[i] <= 'z' ) string[i] &= 0xDF; // or string[i] = tolower( string[i] ); // you'll need: #include <cctype> }

OpenStudy (anonymous):

//This program convert the string to upper case #include<iostream> #include<cstring> #include <cctype> using namespace std; int main() { string str ="my real name is secret munyai from university of limpopo south africa"; int leng=str.length(); cout <<"your string :"; for (int i=0 ;i<=leng-1 ;i++) { cout<<str[i]; } cout<< "\n your string is now in upper cass :"<<endl; //convert to upper case for (int i=0 ;i<=leng-1 ;i++) { str[i]=toupper(str[i]); cout<<str[i]; } cout<<endl; return 0; }

Can't find your answer? Make a FREE account and ask your own questions, OR help others and earn volunteer hours!

Join our real-time social learning platform and learn together with your friends!
Can't find your answer? Make a FREE account and ask your own questions, OR help others and earn volunteer hours!

Join our real-time social learning platform and learn together with your friends!