• This topic is empty.
Viewing 1 post (of 1 total)
  • Author
    Posts
  • #586
    admin
    Keymaster

      I intend to convert word to uppercase. It appears mine is not the correct way. Why it is wrong and how to correct.

      
      
      int compute_score(string word)
      {
          // TODO: Compute and return score for string
          string wordU = toupper(word);
          int x = strlen(word);
          return x;
      
      }

      Update:

      On second thought, since toupper/tolower works on char type (cs50 manual), it will not work on string type.

      Is there any alternative way to make the same work for string?

      Or perhaps need to take char one by one and then convert to uppercase.


      Reply


      https://edstem.org/us/courses/176/discussion/1778073[learn_press_profile]

    Viewing 1 post (of 1 total)
    • You must be logged in to reply to this topic.
    Scroll to Top