homework from university about C++

did somebody can help me to show the source code of this result??? this is my homework... please help me...

1
12
123
1234
12345
1234
123
12
1
it looks like the mirror of that..
so the result is two of them that face to face..
Last edited on
Alright, now I'm only a beginner, but here is what I have so far...
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
#include <cstdlib>
#include <iostream> 
#include <vector> //need for vectors

using namespace std;

int main()
{
    int i, x=1, n=4;
    vector<int> numbers; //used to store the values 1,5;
    vector<int>::iterator output; //used to output results
    
    for (i=1; i<6; i++)
    {
        numbers.push_back(i);  //adds values to vector(numbers)
        }
    while (x <= numbers.size()) {   //makes code run as many times as there are values in the vector
    for (output=numbers.begin(); output < numbers.end() - n; output++)  //subtracting n makes it run through an increasing amount of times (i think)
    {
        cout << *output;
        }
        x++;   //used to keep track of how many times this runs
        n--;    //next time it outputs, it will output one more value of the vector
        cout << endl;  
        }
    system("PAUSE");
    return EXIT_SUCCESS;
}


The output you get from this looks like:
1
12
123
1234
12345


I know its not the whole thing, but its a start, and it's the extent of my High School Programming 1 class knowledge :P
Topic archived. No new replies allowed.