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 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