Bucket Sort...

This is a discussion on Bucket Sort... within the C++ Programming forums, part of the General Programming Boards category; What am I doing wrong here?? Am I reading the file in correctly? What if any thing is wrong with ...

  1. #1
    Registered User
    Join Date
    Apr 2002
    Posts
    6

    Post Bucket Sort...

    What am I doing wrong here?? Am I reading the file in correctly? What if any thing is wrong with the Bucket Sort part? It is supposed to output what the array looks like after each pass and then again after the array is sorted making the minimum # of passes. Also, I am supposed to output what the largest # is and how many digits it is. Thanks again guys!

    #include <iostream.h>
    #include <fstream.h>
    #include <stdlib.h>

    int main()
    {
    ifstream infile ("/u3/svlasnik/values");

    const int size = 6;

    int array[size] = { 0 };

    for ( int x = 0; x < size ; x++ )
    infile >> array[x];

    int *bucketData;
    *bucketData = array[size - 1];

    for(int i = 0; i < array[size - 1]; i++)
    {
    bucketData[i] = (rand() % 1000) / 1000.0;
    for ( int x = 0; x < size ; x++ )
    cout << "Look, here's value " << x << ": " << array[x] << endl;
    }

    return 0;

    }

  2. #2
    I am the worst best coder Quantrizi's Avatar
    Join Date
    Mar 2002
    Posts
    644
    try including the conio header. Why the diggly darnit won't anyone use the friggin' code tags!?!?!?!?!?!?!?!?!

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Floating Exception (Core Dumped)
    By DarrenY in forum C Programming
    Replies: 9
    Last Post: 05-14-2007, 10:01 AM
  2. Clearing Buffer
    By AndyBomstad in forum C++ Programming
    Replies: 11
    Last Post: 04-30-2005, 01:04 AM
  3. Bucket Sort
    By bearcat19 in forum C++ Programming
    Replies: 0
    Last Post: 03-07-2003, 11:27 AM
  4. Bucket Sort Problems... Please Help!
    By 67stangman in forum C++ Programming
    Replies: 1
    Last Post: 04-17-2002, 10:13 PM
  5. Bucket sort & list of lists ???
    By EasternStar in forum C Programming
    Replies: 1
    Last Post: 11-19-2001, 11:48 PM

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21