Quantcast

Got Homework?

Connect with other students for help. It's a free community.

  • across
    MIT Grad Student
    Online now
  • laura*
    Helped 1,000 students
    Online now
  • Hero
    College Math Guru
    Online now

Here's the question you clicked on:

55 members online
  • 0 replying
  • 0 viewing

kris100 Group Title

how to make a program in c++[using Array] that ask the user to input 9 letters and arrange it in alphabetical order. thanks!

  • one year ago
  • one year ago

  • This Question is Closed
  1. chamoda Group Title
    Best Response
    You've already chosen the best response.
    Medals 0

    #include <iostream> #include <string> using namespace std; int main() { string str = ""; cout << "input : "; cin >> str; { for(int i = 0; i < str.size(); i++) { for(int j = i + 1; j < str.size(); j++) { if(str[i] > str[j]) { char temp = str[i]; str[i] = str[j]; str[j] = temp; } } } cout << "output: " << str << "\n"; } }

    • one year ago
  2. across Group Title
    Best Response
    You've already chosen the best response.
    Medals 0

    Here's an implementation that's more specific (it uses an array of characters, not a string object): http://ideone.com/LqqJgD

    • one year ago
  3. kris100 Group Title
    Best Response
    You've already chosen the best response.
    Medals 0

    when i tried your program the output is equal to the imputed char. the program should arranged the imputed char in to alphabetical order.??

    • one year ago
  4. across Group Title
    Best Response
    You've already chosen the best response.
    Medals 0

    Whose program?

    • one year ago
  5. kris100 Group Title
    Best Response
    You've already chosen the best response.
    Medals 0

    The code you posted. when i started debugging it works fine. but when i started imputing letters the output didn't satisfies the problem. it did not arrange the imputed letters into alphabetical order. it only prints the first char imputed.i don't know what's wrong with it.

    • one year ago
  6. across Group Title
    Best Response
    You've already chosen the best response.
    Medals 0

    The code is working correctly with the Ideone compiler. Perhaps your input is incorrect?

    • one year ago
    • Attachments:

See more questions >>>

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.