help

Discussion in 'C++' started by squeek, Apr 4, 2006.

  1. squeek

    squeek Guest

    i am in a C++ programing class in college (i hate computers because i
    learn with my hands and can't tear a computer apart to see how it
    works) and i don't know what i am doing with this class i hate it we
    are currently working with arrays, and i need help writing a program
    that sorts intigers from smallest to to the biggest. thanks in advance
    squeek, Apr 4, 2006
    #1
    1. Advertising

  2. squeek

    Jaspreet Guest

    squeek wrote:
    > i am in a C++ programing class in college (i hate computers because i
    > learn with my hands and can't tear a computer apart to see how it
    > works) and i don't know what i am doing with this class i hate it we
    > are currently working with arrays, and i need help writing a program
    > that sorts intigers from smallest to to the biggest. thanks in advance


    Lets leave the hatred aside for a moment and try on our own to solve
    the problem at hand.

    Say if I give you 5 different integers viz 23, 11, 2, 56, 5 how would
    you go about arranging them in ascending (smallest to bigger) order ?

    You would first start off with 23 and compare it others and bring 11
    forward in place of 23 and then 2 forward and so on...So after the 1st
    round, you would have :
    11, 2, 5, 56, 25....

    Next start off with 11 and continue...

    So continue your rounds and after sometime you may have the array in
    correct order.

    Note : This is not one of the more efficient techniques for sorting
    though. Once you get an idea, someone would try and tell you why it is
    not efficient and which is a better option. But then someone might
    stand up and say why not start with the most efficient technique
    rightaway ? Good question, I dont remember that technique. :(
    Jaspreet, Apr 4, 2006
    #2
    1. Advertising

  3. squeek

    osmium Guest

    "squeek" writes:

    >i am in a C++ programing class in college (i hate computers because i
    > learn with my hands and can't tear a computer apart to see how it
    > works)


    <snip remainder of sentence>

    Sadly, if you *were* allowed to take it apart you would learn exactly
    nothing about how a computer works. You were probably born too late, should
    have been born when men and horses tilled the land for a good honest living
    with lots of man sweat and horse sweat.
    osmium, Apr 4, 2006
    #3
  4. squeek

    benben Guest

    squeek wrote:
    > i am in a C++ programing class in college (i hate computers because i
    > learn with my hands and can't tear a computer apart to see how it
    > works) and i don't know what i am doing with this class i hate it we
    > are currently working with arrays, and i need help writing a program
    > that sorts intigers from smallest to to the biggest. thanks in advance
    >


    I am finding hard to understand why you choose a course that you hate so
    much.

    RED PILL
    Calm down and take a C++ book and try to develop some interest in it.

    BLUE PILL
    Just go ahead change your course to whatever you like, or you don't hate.

    Now pick your poison.

    Regards,
    Ben
    benben, Apr 4, 2006
    #4
  5. squeek

    squeek Guest

    no that is to late but the 50's would have been great
    squeek, Apr 4, 2006
    #5
  6. squeek

    Daniel T. Guest

    In article <>,
    "squeek" <> wrote:

    > i am in a C++ programing class in college (i hate computers because i
    > learn with my hands and can't tear a computer apart to see how it
    > works) and i don't know what i am doing with this class i hate it we
    > are currently working with arrays, and i need help writing a program
    > that sorts intigers from smallest to to the biggest. thanks in advance


    #include <iostream>
    // whatever includes you need for your code

    using namespace std;

    void sort_ints( int* array, unsigned size ) {
    // your code here
    }

    int main() {
    int a[2] = { 2, 1 };
    sort_ints( a, 2 );
    assert( a[0] == 1 );
    assert( a[1] == 2 );
    cout << "Working!\n";
    }

    Take the above code and paste it into your cpp file. Add code to the
    "your code here" spot until it says "Working!". Show us what you have so
    far and we'll help you over the next step.


    --
    Magic depends on tradition and belief. It does not welcome observation,
    nor does it profit by experiment. On the other hand, science is based
    on experience; it is open to correction by observation and experiment.
    Daniel T., Apr 4, 2006
    #6
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. =?Utf-8?B?dHJlbGxvdzQyMg==?=

    HELP! HELP! HELP! Opening Web Application Project Error

    =?Utf-8?B?dHJlbGxvdzQyMg==?=, Feb 20, 2004, in forum: ASP .Net
    Replies:
    0
    Views:
    742
    =?Utf-8?B?dHJlbGxvdzQyMg==?=
    Feb 20, 2004
  2. Harvey
    Replies:
    0
    Views:
    668
    Harvey
    Jul 16, 2004
  3. Harvey
    Replies:
    1
    Views:
    818
    Daniel
    Jul 16, 2004
  4. =?Utf-8?B?S2ltb24gSWZhbnRpZGlz?=

    HELP - HELP - HELP

    =?Utf-8?B?S2ltb24gSWZhbnRpZGlz?=, Mar 9, 2006, in forum: ASP .Net
    Replies:
    4
    Views:
    662
    Eliyahu Goldin
    Mar 9, 2006
  5. Buster

    Help, Help, Help

    Buster, Oct 4, 2003, in forum: Java
    Replies:
    3
    Views:
    461
    Saager
    Oct 30, 2003
Loading...

Share This Page