anonymous
  • anonymous
how to make a program in c++[using Array] that ask the user to input 9 letters and arrange it in alphabetical order. thanks!
Computer Science
  • Stacey Warren - Expert brainly.com
Hey! We 've verified this expert answer for you, click below to unlock the details :)
SOLVED
At vero eos et accusamus et iusto odio dignissimos ducimus qui blanditiis praesentium voluptatum deleniti atque corrupti quos dolores et quas molestias excepturi sint occaecati cupiditate non provident, similique sunt in culpa qui officia deserunt mollitia animi, id est laborum et dolorum fuga. Et harum quidem rerum facilis est et expedita distinctio. Nam libero tempore, cum soluta nobis est eligendi optio cumque nihil impedit quo minus id quod maxime placeat facere possimus, omnis voluptas assumenda est, omnis dolor repellendus. Itaque earum rerum hic tenetur a sapiente delectus, ut aut reiciendis voluptatibus maiores alias consequatur aut perferendis doloribus asperiores repellat.
schrodinger
  • schrodinger
I got my questions answered at brainly.com in under 10 minutes. Go to brainly.com now for free help!
anonymous
  • anonymous
#include #include 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"; } }
across
  • across
Here's an implementation that's more specific (it uses an array of characters, not a string object): http://ideone.com/LqqJgD
anonymous
  • anonymous
when i tried your program the output is equal to the imputed char. the program should arranged the imputed char in to alphabetical order.??

Looking for something else?

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

More answers

across
  • across
Whose program?
anonymous
  • anonymous
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.
across
  • across
The code is working correctly with the Ideone compiler. Perhaps your input is incorrect?

Looking for something else?

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