C++

Write a Program that Gets Five Inputs from the User in an Array and then Sorts this Array in Ascending Order.

By April 8, 2016 November 9th, 2016 27 Comments

#include<iostream.h>
#include<conio.h>
void main( )
{
int arr[5], i, j, min, temp;
for(i = 0; i < 5; i++)
{
cout << “Enter Value: ”;
cin >> arr[i];
}
cout << “The Original Values in Array:\n”;
for(i = 0; i < 5; i++)
cout << arr[i] << “ ”;
for(i = 0; i < 5; i++)
{
min = i;
for(j = i + 1; j < 5; j++)
if(arr[j] < arr[min])
min = j;
if(min != i)
{
temp = arr[i];
arr[i] = arr[min];
arr[min] = temp;
}
}
cout << “\n The Sorted Array:\n”;
for(i = 0; i < 5; i++)
cout << arr[i] << “ ”;
getch( );
}



27 Comments

  • An attention-grabbing dialogue is worth comment. I believe that you need to write extra on this topic, it may not be a taboo topic however typically people are not sufficient to speak on such topics. To the next. Cheers

  • yeezy boost says:

    I simply wanted to write down a small note in order to say thanks to you for all the wonderful solutions you are placing on this site. My particularly long internet search has at the end of the day been paid with pleasant know-how to exchange with my good friends. I ‘d assert that we readers are quite endowed to dwell in a notable website with so many perfect professionals with helpful points. I feel truly happy to have discovered your entire web page and look forward to plenty of more exciting moments reading here. Thanks once more for a lot of things.

  • I抎 must examine with you here. Which isn’t one thing I often do! I get pleasure from studying a post that will make people think. Additionally, thanks for permitting me to comment!

  • This site is known as a stroll-by for all of the data you needed about this and didn抰 know who to ask. Glimpse here, and also you抣l undoubtedly discover it.

  • The next time I learn a blog, I hope that it doesnt disappoint me as a lot as this one. I imply, I do know it was my choice to learn, but I truly thought youd have something attention-grabbing to say. All I hear is a bunch of whining about something that you may fix in the event you werent too busy searching for attention.

  • It is best to take part in a contest for among the best blogs on the web. I will suggest this site!

  • adidas nmd says:

    The next time I learn a blog, I hope that it doesnt disappoint me as a lot as this one. I imply, I know it was my option to learn, but I actually thought youd have one thing interesting to say. All I hear is a bunch of whining about one thing that you could fix when you werent too busy looking for attention.

  • You made some decent factors there. I regarded on the web for the difficulty and located most people will go together with along with your website.

  • I was more than happy to find this internet-site.I wished to thanks on your time for this glorious read!! I positively having fun with every little little bit of it and I’ve you bookmarked to take a look at new stuff you blog post.

  • Oh my goodness! a tremendous article dude. Thank you Nevertheless I’m experiencing problem with ur rss . Don抰 know why Unable to subscribe to it. Is there anybody getting equivalent rss problem? Anyone who is aware of kindly respond. Thnkx

  • yeezy shoes says:

    I wish to convey my gratitude for your kind-heartedness in support of men and women who must have guidance on this particular niche. Your very own dedication to passing the message throughout turned out to be exceptionally functional and have surely empowered individuals like me to reach their aims. This warm and helpful guide signifies a whole lot to me and even more to my office workers. Best wishes; from everyone of us.

  • I discovered your weblog site on google and verify a couple of of your early posts. Continue to maintain up the very good operate. I just further up your RSS feed to my MSN News Reader. In search of ahead to reading more from you in a while!?

  • There is noticeably a bundle to learn about this. I assume you made sure nice factors in options also.

  • I’m usually to blogging and i actually respect your content. The article has really peaks my interest. I am going to bookmark your website and preserve checking for brand spanking new information.

  • Nice post. I study one thing more challenging on completely different blogs everyday. It can all the time be stimulating to read content from other writers and apply a bit something from their store. I抎 favor to make use of some with the content material on my weblog whether you don抰 mind. Natually I抣l give you a hyperlink on your web blog. Thanks for sharing.

  • Aw, this was a very nice post. In concept I want to put in writing like this moreover ?taking time and actual effort to make a very good article?however what can I say?I procrastinate alot and on no account appear to get one thing done.

  • Needed to write you the tiny observation to be able to thank you very much over again for those nice tricks you have discussed above. It’s simply shockingly generous of people like you to provide unreservedly precisely what a lot of folks might have distributed as an e-book to end up making some bucks for their own end, especially considering the fact that you might well have done it if you desired. Those suggestions also acted like the fantastic way to fully grasp many people have the identical interest much like my own to figure out a lot more with regards to this problem. I am sure there are thousands of more pleasant sessions ahead for those who go through your website.

  • yeezy boost says:

    I wish to get across my respect for your kindness in support of persons that absolutely need help with your niche. Your personal commitment to passing the message along ended up being astonishingly good and has constantly helped professionals much like me to get to their dreams. Your personal useful guideline signifies a lot to me and additionally to my colleagues. Best wishes; from everyone of us.

  • very nice publish, i definitely love this website, carry on it

  • roshe run says:

    Your place is valueble for me. Thanks!?

  • Would you be desirous about exchanging hyperlinks?

  • You made some decent factors there. I regarded on the web for the issue and located most people will associate with together with your website.

  • yeezy boost says:

    Needed to post you the tiny observation so as to say thanks as before considering the great views you have discussed on this website. It is certainly tremendously open-handed of people like you to make publicly just what a few individuals could possibly have advertised as an e book in order to make some bucks for their own end, principally seeing that you could have tried it if you ever desired. These suggestions likewise acted to become good way to realize that many people have the same desire like my personal own to grasp significantly more on the subject of this condition. I think there are millions of more pleasurable opportunities up front for people who take a look at your site.

  • There are certainly numerous particulars like that to take into consideration. That could be a nice point to deliver up. I offer the ideas above as normal inspiration however clearly there are questions just like the one you carry up the place crucial factor will be working in sincere good faith. I don?t know if finest practices have emerged around things like that, but I’m positive that your job is clearly recognized as a good game. Both girls and boys feel the influence of just a second抯 pleasure, for the rest of their lives.

  • Your place is valueble for me. Thanks!?

  • I discovered your weblog site on google and test a couple of of your early posts. Proceed to maintain up the very good operate. I just additional up your RSS feed to my MSN News Reader. In search of ahead to reading extra from you later on!?

  • Can I simply say what a aid to find someone who actually is aware of what theyre speaking about on the internet. You undoubtedly know the way to convey a problem to gentle and make it important. More people must read this and understand this aspect of the story. I cant imagine youre not more popular because you undoubtedly have the gift.

Leave a Reply