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 10:45

int main(void)
{
    // Initialize a (list|table) here

    // Loop input collection function here
    // Append input to list or break loop if no more input

    // ::sort

    // Iterate through list and print to stdout

    return 0;
}


Fill in the blanks

Name: Anonymous 2007-11-28 10:46

>>2
Oh thank you that was soooooooooooooooooooooo helpful...

Name: Anonymous 2007-11-28 10:49

Look, I know I'm being a dick, but I really need a good grade!

The problem is that I have no fucking clue about how to sort the numbers in growing order (if that wasn't clear enough), so I don't know if you thought you were helping, but, well, you weren't.

Name: Anonymous 2007-11-28 10:51

You deserve to fail if you do not understand the material. That is how school works.

Name: Anonymous 2007-11-28 10:54

>>5
I understand every other material, so why should I fail for this one?

Name: Anonymous 2007-11-28 10:56

>>6
Because you don't understand this one.

Name: Anonymous 2007-11-28 10:59

OP should fail. Hard.

Name: Anonymous 2007-11-28 10:59

>>7
I understand your logic, but I want to understand how C++ works, and that was the first reason why I came here, so you could help me understand it better, thus making me able to write the program I need.

Name: Anonymous 2007-11-28 11:00

>>8
Why please?

Oh, and if any of you could actually HELP me, well, I'd be grateful

Name: Anonymous 2007-11-28 11:02

Here's a hint: ask the teacher.

Name: Anonymous 2007-11-28 11:03

>>10
What the fuck are you studying and why can't you program?

Name: Anonymous 2007-11-28 11:07

>>11
It's due for tomorrow, so that's not an option, unfortunately.

>>12
I'm in an institute of technology, studying electrical and electronical engineering, and computer science is part of it.

Name: Anonymous 2007-11-28 11:07

coefficiented, lol

Name: Anonymous 2007-11-28 11:08

>>14
Sorry if I made a mistake, I'm french and my english is not perfect

Name: Anonymous 2007-11-28 11:10

http://www.cs.brown.edu/people/jak/proglang/cpp/stltut/tut.html

Use version 2, as version 1 is too lame and version 3 is complicated enough to indicate that you plagiarised it.

Name: Anonymous 2007-11-28 11:40

/prog/ is for programmers, not for non-programmers trying to become such.

Name: Anonymous 2007-11-28 12:02

>>17
EXPERT PROGRAMMERS, even.

Name: Anonymous 2007-11-28 15:26

So frenchie still around?

Name: Anonymous 2007-11-28 15:32

>>19
yup, still haven't solved my problem (link provided by >>16 was helpful, but I can't use it, because we're supposed to use for, while, if and table only (sorry I didn't mention it firsthand)).

So, me and my friend are still working on it.

Name: Anonymous 2007-11-28 16:14

Look, I really need some help to get a good grade.  If I don't my parents will beat me again.

Name: Anonymous 2007-11-28 16:31

>>21
That's why we read SICP and learn to program on our own.

Name: Anonymous 2007-11-28 16:34

What's the problem here? Just write a trivial bubble sort and be done with it.

Name: Anonymous 2007-11-28 16:35

>>23
Only Jews choose bubblesort over quicksort.

Name: Anonymous 2007-11-28 16:39

>>24
You have two minutes to write a correct implementation of a sorting algorithm. If you fail, you will be brutally gangraped and then killed. YOUR CHOICE?

a. bubblesort
b. quicksort

Name: Anonymous 2007-11-28 16:42

>>25
what's bubblesort and quicksort?

>>23
The problem obviously is that I have no idea about how to sort the numbers... (I'm STILL working on it btw, but still, no idea (ones I had didn't work))

Name: Anonymous 2007-11-28 16:45

Just use Monads and lambda haskell over closed manifolds.

Name: Anonymous 2007-11-28 16:48

>>27
As if I had a clue of what you're talking about

Name: Anonymous 2007-11-28 16:48

Why not just use arrays to put the variables in.
And then sort them into another array?

Name: Anonymous 2007-11-28 16:49

>>26
OMG, what are you doing here?

Name: Anonymous 2007-11-28 16:52

The easiest way is to just input them on an array, then bubble sort them. Trust me, it can't get any easier than that.

Just search for "buble sort example". And you are on your way.

Do it, faggot.

Name: Anonymous 2007-11-28 16:56

ITT people who prefer bubble sort because they are afraid of full recursion.

Name: Anonymous 2007-11-28 16:58

Well, it's 23:00 where i live (that is to say in france), so i'm going to bed nao, but, remember this, I WILL BE BACK! tomorrow to be exact, I will poast the answer our teacher gave us, and submit it to your judgment.

Thanks to all of you who sincerely tried to help me, I will bump this thread tomorrow (if it still exists) otherwise I will just make another one.

Thank you and goodafternoon, it seems

Name: Anonymous 2007-11-28 16:59

>>33
DONY LISTEN TO BUBBLE LEIS

Name: Anonymous 2007-11-28 17:09

>>20
What do you mean by table?

Name: Anonymous 2007-11-28 17:10

>>32
We are not. We are just telling him the easiest way around it.

He could have coded it in 5 or 10 minutes.

Name: Anonymous 2007-11-28 17:10

>>33
Post your code here, and we may fix it.

Name: Anonymous 2007-11-28 17:10

I feel like we've all collectively failed.

Name: Anonymous 2007-11-28 17:13

>>38
I feel like you don't beling here.

Name: Anonymous 2007-11-28 17:16

MASSIVE BUMP!!

My good friend (roommate actually) just found this (it works, that's all I care about)

WARNING: The following content may cause eye bleeding to advance coder. Procede with extreme caution

So here it is:

#include <math.h>
#include <stdio.h>
#include <conio.h>

main()
{
      int i,j,min,min1,min2,min3,min4,min5,min6,min7;
      int tab[7];
      printf("entrez 7 valeures\n");
      for(i=1;i<=7;i++)
      {
                       scanf("%d",&tab[i]);
      }
      printf("%d %d %d %d %d %d %d\n",tab[1],tab[2],tab[3],tab[4],tab[5],tab[6],tab[7]);
      min=tab[1];
      for(i=1;i<=7;i++)
      {
                       if(tab[i]<min)
                       min=tab[i];
      }     
      for(i=1;i<=7;i++)
      {
                       if(tab[i]<min1)
                       {
                                      for(j=1;j<=7;j++)
                                      {
                                                       if(tab[i]>min && tab[i]<tab[j])
                                                       min1=tab[i];
                                                      
                                      }
                       }
                      
                      
                      
                      
      }
      for(i=1;i<=7;i++)
      {
                       if(tab[i]<min2)
                       {
                                      for(j=1;j<=7;j++)
                                      {
                                                       if(tab[i]>min1 && tab[i]<tab[j])
                                                       min2=tab[i];
                                                      
                                      }
                       }
                      
                      
                      
                      
      }
      for(i=1;i<=7;i++)
      {
                       if(tab[i]<min3)
                       {
                                      for(j=1;j<=7;j++)
                                      {
                                                       if(tab[i]>min2 && tab[i]<tab[j])
                                                       min3=tab[i];
                                                      
                                      }
                       }
                      
                      
                      
                      
      }
      for(i=1;i<=7;i++)
      {
                       if(tab[i]<min4)
                       {
                                      for(j=1;j<=7;j++)
                                      {
                                                       if(tab[i]>min3 && tab[i]<tab[j])
                                                       min4=tab[i];
                                                      
                                      }
                       }
                      
                      
                      
                      
      }
      for(i=1;i<=7;i++)
      {
                       if(tab[i]<min5)
                       {
                                      for(j=1;j<=7;j++)
                                      {
                                                       if(tab[i]>min4 && tab[i]<tab[j])
                                                       min5=tab[i];
                                                      
                                      }
                       }
                      
                      
                      
                      
      }
      for(i=1;i<=7;i++)
      {
                       if(tab[i]<min6)
                       {
                                      for(j=1;j<=7;j++)
                                      {
                                                       if(tab[i]>min5 && tab[i]<=tab[j])
                                                       min6=tab[i];
                                                      
                                      }
                       }
                      
                      
                      
                      
      }
    
      printf("%d, %d , %d, %d, %d, %d, %d, le min: %d\n",min,min1,min2,min3,min4,min5,min6,min);
      printf("%d, %d , %d, %d, %d, %d, %d le min: %d \n",min1,min,min3,min2,min5,min4,min6,min);
     
getch();
}



So, yeah, what do you think about it?

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