TIP: Click on subject to list as thread! ANSI
echo: c_plusplus
to: ALL
from: CHRISTIAN FELDE
date: 1998-01-22 17:06:00
subject: sort.cpp

Can't say I see what's wrong with this. There's no error in compiling it, and 
when I try to run it, there's no output, and no input I give does anything. 
So then I must brake it with ctrl+c to return to command line.
[start of source]
// sort.cpp
#include 
void main()
{
        const int MAX = 10;
        int table[MAX];
        int i;
        int temp, test = 0;
        cout << "\n\n\tThis program demostrates sorting array "
             << "elements into\n\tdescending order\n\n"
             << "\tEnter ten integers:\n";
        for (i = 0; i < MAX; i++)
        {
                cout << i + 1 << ".: ";
                cin >> table[i];
        }
        cout << "\n\n\tThe unsorted array is: ";
        for (i = 0; i < MAX; i++)
                cout << table[i] << " ";
        //sort
        while(test == 0)
        {
                test = 1;
                for (i = 0; i < (MAX - 1); i++)
                {
                        if (table[i] < table[i + 1])
                        {
                                temp = table[i];
                                table[i] = table[i + 1];
                                table[i + 1] = temp;
                                test = 0;
                        }
                }
        }
        cout << "\n\n\tThe sorted array is: ";
        for (i = 0; i < MAX; i++)
                cout << table[i] << " ";
}
[end of source]
Anyone who can help me?
         __ __ __ __ _  _
        /_ // / // ///\//      email: scooby@applausenett.no
_ _ __ __//_ /_//_//_///    homepage: http://www.applausenett.no/~scooby/
--- BBBS/L v3.33 How
---------------
* Origin: Fluxpod Information eXchange, telnet://fix.no (2:210/30)

SOURCE: echomail via exec-pc

Email questions or comments to sysop@ipingthereforeiam.com
All parts of this website painstakingly hand-crafted in the U.S.A.!
IPTIA BBS/MUD/Terminal/Game Server List, © 2025 IPTIA Consulting™.