Quantcast

A community for students. Sign up today!

Here's the question you clicked on:

55 members online
  • 0 replying
  • 0 viewing

JASdeep11

  • 2 years ago

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

  • This Question is Closed
  1. dk-info
    • 2 years ago
    Best Response
    You've already chosen the best response.
    Medals 0

    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.

  2. rsmith6559
    • 2 years ago
    Best Response
    You've already chosen the best response.
    Medals 0

    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> }

  3. pointme
    • 2 years ago
    Best Response
    You've already chosen the best response.
    Medals 0

    //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; }

  4. Not the answer you are looking for?
    Search for more explanations.

    • Attachments:

Ask your own question

Ask a Question
Find more explanations on OpenStudy

Your question is ready. Sign up for free to start getting answers.

spraguer (Moderator)
5 → View Detailed Profile

is replying to Can someone tell me what button the professor is hitting...

23

  • Teamwork 19 Teammate
  • Problem Solving 19 Hero
  • You have blocked this person.
  • ✔ You're a fan Checking fan status...

Thanks for being so helpful in mathematics. If you are getting quality help, make sure you spread the word about OpenStudy.

This is the testimonial you wrote.
You haven't written a testimonial for Owlfred.