URGENT just freezes and shuts down?

Alright let's say my program takes in input and puts it into an output.bin file. How would I take the contents of that file and alphabetically sort and display the information? I would like to create a function specifically to do this.
I can't get my program to display anything it just freezes and shuts down.
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
void nodeSwap(struct nodeType *p, struct nodeType *q)
{
    struct nodeType *t1, *t2, *t3;
    if (p != q)
    {
        t1 = p->link;
        t2 = q->link;
        t3 = q->link->link;
        p->link = q->link;
        q->link = t1;
        t2->link = t1->link;
        t1->link = t3;
    }
}
void alpha(nodeType*& first,nodeType*& last)
{
    struct nodeType *i,*j,*min;
    for (i = first; i->link != NULL; i = i->link)
    {
        min = i;
        for (j = i->link; j->link != NULL; j = j->link)
        {
            if (j->link->info < min->link->info)
            {
                min = j;
            }
        }
        nodeSwap(i,min);
    }
    fstream fout;
    fout.open( "output.bin" , ios :: binary | ios :: in );
    nodeType *current = first->link;

    while (current != NULL)
    {
        cout << current->info <<endl;
        current = current->link;
    }
}
Last edited on
Topic archived. No new replies allowed.