help me with solving this!!!!!!1

Mar 12, 2013 at 3:31pm
write a program that prompts the user to input three numbers. the program should
then output the numbers in ascending order!!!


i'am trying to do it. but i dont know how to output the three numbers together
in the correct order...
Mar 12, 2013 at 3:44pm
closed account (3qX21hU5)


Edit: Had some help posted here but deleted it because this user is unwilling to do his own work and has been asking (in PM's) to "Just give me the codes". So Myadvice let him figure it out on his own.
Last edited on Mar 12, 2013 at 4:10pm
Mar 12, 2013 at 4:36pm
Did you try running it with various data sets that would exercise its functionality???

Mar 12, 2013 at 5:05pm
Try this:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
#include <iostream>
#include <cmath>
#include <vector>
#include <algorithm>

using namespace std;
int main ()
{
    int v;
    vector<int> numbers;
    int temp;
    while(true)
    {
        v=-4;
        while(!(v>0))
        {
            cout << "How many numbers do you want to sort?    ";
            cin >> v;
        }
        for(int i=0; i<v; i++)
        {
            cout << "Give me number ";
            cout << i+1;
            cout << ":  ";
            cin >> temp;
            numbers.push_back(temp);
        }
        sort (numbers.begin(), numbers.end());
        for(unsigned int j=0;j<numbers.size(); j++)
        {
            cout << numbers[j];
            cout << " - ";
        }
        cout << endl;
    }
    return 0;
}
Mar 12, 2013 at 5:34pm
closed account (3qX21hU5)
Sigh well there you go OP you got your code to copy and paste.

Also to the OP please stop sending me PM's you don't need to send 20 pm's that keep asking for something I already told you no to.
Last edited on Mar 12, 2013 at 5:36pm
Topic archived. No new replies allowed.