Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > C++ > help

Reply
 
 
squeek
Guest
Posts: n/a
 
      04-04-2006
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

 
Reply With Quote
 
 
 
 
Jaspreet
Guest
Posts: n/a
 
      04-04-2006

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.

 
Reply With Quote
 
 
 
 
osmium
Guest
Posts: n/a
 
      04-04-2006
"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.



 
Reply With Quote
 
benben
Guest
Posts: n/a
 
      04-04-2006
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
 
Reply With Quote
 
squeek
Guest
Posts: n/a
 
      04-04-2006
no that is to late but the 50's would have been great

 
Reply With Quote
 
Daniel T.
Guest
Posts: n/a
 
      04-04-2006
In article < .com>,
"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.
 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Help Help Help Pentax S5i Help needed (Please) The Martian Digital Photography 14 06-20-2008 07:56 AM
HELP - HELP - HELP =?Utf-8?B?S2ltb24gSWZhbnRpZGlz?= ASP .Net 4 03-09-2006 12:46 PM
HELP WANTED HELP WANTED HELP WANTED Harvey ASP .Net 1 07-16-2004 01:12 PM
HELP WANTED HELP WANTED HELP WANTED Harvey ASP .Net 0 07-16-2004 10:00 AM
HELP! HELP! HELP! Opening Web Application Project Error =?Utf-8?B?dHJlbGxvdzQyMg==?= ASP .Net 0 02-20-2004 05:16 PM



Advertisments
 



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 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57