i tried your code and it didn't swap any at all. im trying to do it with a selection sort instead of bubble if that is at all possible.
Type: Posts; User: deathrattle
i tried your code and it didn't swap any at all. im trying to do it with a selection sort instead of bubble if that is at all possible.
i removed the second trav++; and it is still only swapping the top name that is out of order to its correct spot.
are you referring to the trav++; after the if? i'm playing around with all kinds of stuff and cannot figure out which section of the loop you are referring to.
allllright, now we're gettin somewhere. i took out the pass++; and more whoabuddys came up but it still wasnt swapping. in the call of the swap function, i changed &identity[pass] to &identity[pass +...
i put a "WHOABUDDY" at the bottom of the swap function. it printed the list of names, WHOABUDDY twice, and then the list of names again still unsorted. the two whoabuddy's look odd to me as it is...
alrighty, its back to pointers. again it compiles but still no swaps.
void swap(STUDENT *pN1, STUDENT *pN2)
{
STUDENT temp;
temp = *pN1;
*pN1 = *pN2;
alright, i changed it from an array to just one 1 temp variable. i then changed them from pointers to just objects. i then had to change the & symbols from the calling function. it compiles with no...
and i've gotten it to give no warnings now, but it is still not swapping. baby steps :D
[CODE]
void swap(STUDENT *pN1, STUDENT *pN2)
{
STUDENT *temp[MAX];
*temp = pN1;
...
well after a few replies on different threads by many different people. i've noticed that a lot ask for more code posted, so i thought id just cancel out that, but i apologize if it bothers you :/
oops, that first one i didnt mean to send. i had clicked on preview and went back to edit i thought. its early. sorry :/
this is what i'm getting it to print
$ ./a.out
Created by
Name Level SSN Birthdate
---- ----- --- ...
With this program, I'm trying to open a file that contains a list of people's names, birth dates, grade numbers, and SSN. I can get it to read the pieces from the file and print them but I'm trying...
so in my test file, there are two numbers. the first is the seed and the second is how many times a pair of dice will roll. i cannnnnnnot figure out how to get fscanf to read in the values so that i...
in the program, there is a section where you generate a series of numbers that is seeded from a user's input. the user also determines how many numbers should be generated. this part is fine,...
thank you for helping
please delete this thread