Thread: Bucket Sort...

  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, 12:27 PM
  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-20-2001, 12:48 AM