Need help writing a program that reads a series of 5 integers and determines the largest and smallest.
31N513N
0
Newbie Poster
Recommended Answers
Jump to PostWhat have you got so far?
Jump to Postuse selsort
#include<iostream.h> #include<conio.h> void sel_sort (int array[20],int x) { int i, j, first, temp; for (i= x - 1; i > 0; i--) { first = 0; for (j=1; j<=i; j++) { if (array[j] < array[first]) first = j; } temp = array[first]; array[first] = array[i]; …
Jump to Post>use selsort
"How do I cross this creek without getting my feet wet?"
"Use a 747 to fly over it."
Jump to PostWhat narue is trying to say, in her own clever little way, is that your solution (atish00) is a bit overkill.
Think about it, you don't need to sort anything.
Also some elements of your code are just plain wrong. I bet you are using the antiquated version …
All 15 Replies
henpecked1
0
Posting Whiz in Training
atish00
0
Junior Poster
Narue
5,707
Bad Cop
Team Colleague
iamthwee
atish00
0
Junior Poster
Narue
5,707
Bad Cop
Team Colleague
henpecked1
0
Posting Whiz in Training
atish00
0
Junior Poster
VernonDozier
2,218
Posting Expert
Featured Poster
Dave Sinkula
2,398
long time no c
Team Colleague
prushik
50
Junior Poster
Narue
5,707
Bad Cop
Team Colleague
atish00
0
Junior Poster
Narue
5,707
Bad Cop
Team Colleague
JRM
107
Practically a Master Poster
Be a part of the DaniWeb community
We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.