Return Styles: Pseud0ch, Terminal, Valhalla, NES, Geocities, Blue Moon. Entire thread

Halp plz, C++

Name: Anonymous 2007-11-28 10:39

Hi /prog/, I have a problem...

I'm a noob at C++ (I learned it at school, so, yeah...) and I've got to make a program, which I find pretty difficult. i'm coming here seeking your help because I NEED a good grade if I want to validate my semester, and programming is highly coefficiented, so if you don't help me, i'm pretty much fucked...

So here's the deal:

Make a program which allows the input of a serie of integers and stocks them in a table, then display the table as it is and then display the table with the numbers sorted out in growing order...

I am a total noob at C (as I already mentioned) and I have no fucking clue about how to do this kind of shit.

So your help would be really, really, REALLY appreciated...
Pretty please?

Name: Anonymous 2007-11-28 18:48

Fucking die in a fire you good-for-nothing fucking french faggot.

#include <iostream>
#include <vector>
#include <algorithm>

typedef NumT int;
typedef std::vector<NumT> ListT;

void print_list( const ListT& list ) {
    for ( ListT::const_iterator i = list.begin();
        i != list.end(); ++i )
        std::cout << *i << " ";
}

int main( int argc, char* argv[] ) {
    ListT list;   
    while( std::cin.good() ) {
        NumT tmp;
        std::cin >> tmp;
        list.push_back( tmp );
    }

    print_list( list );
    std::cout << std::endl;
    std::sort( list.begin(), list.end() );
    print_list( list );
}

Newer Posts
Don't change these.
Name: Email:
Entire Thread Thread List