hello, i'm newbie here and also in programming world. so I would to request help from pros here. my question is, how to print out number entered in random in ascending order WITHOUT USING ARRAY AND FUNCTION? let say the user key in 4, 56, 31, 90, 11 and the output would be 4, 11, 31, 56, 90. hope anyone would help me.
thank you.
din_hilmi 0 Newbie Poster
Recommended Answers
Jump to PostFive numbers can be ordered 5! or 120 ways. The no-brainer way of writing this code would thus be writing an if statement with 119 "else if" statements, one for each possible ordering. You should be using <= instead of < (what if two elements are the same?). There may …
Jump to Postquite true vernon.. any idea to make it more simpler..?? im not allowed to use array and function to settle this assignment.. uhuh.. >.<
"Simple", "efficient", "correct", and "not tedious" are different concepts. Your "easiest", most brain-dead method is to make 120 "if" statements, not taking advantage of the results …
Jump to Postquite true vernon.. any idea to make it more simpler..?? im not allowed to use array and function to settle this assignment.. uhuh.. >.<
I didnt get it 1stperson.. mind to show me..??
I'm looking at the post times. This one comes two posts after firstPerson's post. Quite fast. I …
Jump to PostI wrote something for this and if you want to put in more numbers its really easy (not as easy if you would just use arrays) if you read the code and see what I'm doing.
#include <iostream> using namespace std; int main() { int n1, n2, …
Jump to Postsfuo, thanks very much! I really bad in making switch statement and perhaps you may put comments in this code to make me easier to read and alter it to use in my programming.. you really helpful.. thanx again..
He just gave you the entire program and now you want …
All 29 Replies
mrnutty 761 Senior Poster
samsons17 -4 Posting Whiz in Training
din_hilmi 0 Newbie Poster
samsons17 -4 Posting Whiz in Training
din_hilmi 0 Newbie Poster
mrnutty 761 Senior Poster
samsons17 -4 Posting Whiz in Training
din_hilmi 0 Newbie Poster
samsons17 -4 Posting Whiz in Training
din_hilmi 0 Newbie Poster
din_hilmi 0 Newbie Poster
samsons17 -4 Posting Whiz in Training
VernonDozier 2,218 Posting Expert Featured Poster
din_hilmi 0 Newbie Poster
mrnutty 761 Senior Poster
din_hilmi 0 Newbie Poster
mrnutty 761 Senior Poster
VernonDozier 2,218 Posting Expert Featured Poster
kvprajapati commented: Excellent advice. +6
VernonDozier 2,218 Posting Expert Featured Poster
sfuo 111 Practically a Master Poster
din_hilmi 0 Newbie Poster
mrnutty 761 Senior Poster
VernonDozier 2,218 Posting Expert Featured Poster
din_hilmi 0 Newbie Poster
solowing 0 Newbie Poster
Maha_6 -3 Newbie Poster
rproffitt commented: Please start a new question. Also, if you need it fast, how much are you paying? -3
JamesCherrill 4,733 Most Valuable Poster Team Colleague Featured Poster
DGPickett 20 Newbie Poster
Aditya_47 0 Newbie 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.