Oh, nevermind. I fixed it.
Type: Posts; User: preeengles
Oh, nevermind. I fixed it.
Uhm...there was a problem with the file handling...I'm doing it wrong again. See, I edited your code to follow instructions but I messed it up. I'm a failure!:o
I mixed display and sort :|
When I...
I apologize for what I said (in ref to MK's post). I said that because it was part of the instructions to merge the two together, or at least that's what I have understood.
@Adak: *facepalm* God,...
Wait a minute, I'm not trying to swap it that way. Look at my code closely. The strcpys were not meant to swap the records. I took one record and stored each of its fields in new variables (ex....
Wait a minute, I placed the for loop to count the number of records. It will be used for the next for loop. :(
I think I'll just leave it at that. I'm more concerned with the bug in my code....
Well the only reason I'm not using arrays is because my first work would be such a waste if I changed it. Like I said, my first work didn't use arrays and mostly used file handling instead. I don't...
This is my array version...It's got no file handling in it. The sorting part is found at the display_all function. I've stopped working on this for a while now. But I remember, there was one time it ...
I'm just silly. I've made two programs already. The first one didn't use arrays so I tried to use this approach. I took two records, stored them in new variables, compared them to see which is...
Uhm...this is my lame attempt so far...Somebody please give me some pointers as to how to make this work...cuz it's not working.
for(i=1;i<=tot_rec-1;i++)
{
for(j=1;j<=tot_rec-i;j++)...
I'm just lost. I'm experimenting with my code right now, but no success so far...
I haven't learned about linked lists yet and I have to finish this program asap. :(
I edited my first post. I placed there a sample of my code.
I wanted to learn merge sort and I think I kinda get the idea of how it works. But I don't know how to implement it in my code.
By...
Alright. I'll try mergesort :)
edit:
@Adak: I'm planning to sort about 10 records. I want them sorted based on student#...
Actually, this question is related to the program I made before (the one in the the thread 'Something wrong with output'). This time, I want to sort the records....
File handling? :|
I'm not using arrays, by the way...Will using qsort still be okay?
I want to sort the records in a file in ascending order. Is there any predefined function for this? If there's none, can anyone give me a tutorial link, sample code, or an algorithm that would be...
Wow, Adak, you're an angel. At first, I got really nervous cuz the first time I ran your code, it crashed. But ran it again and, YES! It worked! I'm so happy!
Hmmm...I should learn more about file...
quzah's asked me the same thing before (i.e. to post only a small sample)...but I don't even know exactly which part caused the problem.
Yeah, the display works fine, and only crashes when I modify one of the records inputted.
Well he said he ran the program on Unix...I've never tried Unix before. Would running the program on...
*SIGH* I'm getting really ........ed with this already. Just a while ago, the program worked fine. I thought the problem was finally done but when I tried rerunning the program, it crashed again.
...
@Quzah: I tried that but the only difference it made was it placed the latest record inputted at the end of the file.
@Adak: Really sorry if I'm being dumb. I have a feeling I'm doing it wrong....
when you tried doing that in your compiler, did it work fine? In my case, it didn't. This is what I did in the add_record() (is it correct?):
void add_record()
{
record stud;
char...
Um...may I ask how? I don't quite get what you're referring to. Oh, and thanks for the help again.
@Quzah: yeah, I just figured the crash has something to do with the struct. And yeah, maybe I shouldn't have included that menu thingy when I posted my code.
Now what to do next? It seems Adak's...