int main()
{
int i;
int x;
int j;
int temp;
int a[30];
int n;
for (i = 1; i < 30; i++) // i=0;
{
cout << "please enter your number" << endl;
cin >> x; // cin >> a[i]
}
for (i = 0; i < 29; i++) // i < 30
{
for (j = 0; j < 30; j++) // j < 29
{
if (a[j] >= a[j + 1]); // remove ; at end
{
int temp = a[j + 1];
a[j + 1] = j; // = a[j]
a[j] = temp;
}
}
}
for (n = 0; n < 30; n++); // remove ; at end
{
cout << a[n]; // optional add blank space or newline between numbers
}
return 0;
}
Edit: or to sort from high to low, change if (a[j] >= a[j + 1]) to if (a[j] <= a[j + 1])
tnx a lot it goes one step forward and dont break but its still dont show the result and after take 30 num its close
in show out put from debug show this messages
'ConsoleApplication1.exe' (Win32): Loaded 'C:\Users\robert\Desktop\programing\4\ConsoleApplication1\Debug\ConsoleApplication1.exe'. Symbols loaded.
'ConsoleApplication1.exe' (Win32): Loaded 'C:\Windows\SysWOW64\ntdll.dll'. Cannot find or open the PDB file.
'ConsoleApplication1.exe' (Win32): Loaded 'C:\Windows\SysWOW64\kernel32.dll'. Cannot find or open the PDB file.
'ConsoleApplication1.exe' (Win32): Loaded 'C:\Windows\SysWOW64\KernelBase.dll'. Cannot find or open the PDB file.
'ConsoleApplication1.exe' (Win32): Loaded 'C:\Program Files\Bitdefender\Bitdefender 2015\active virus control\Avc3_00399_003\avcuf32.dll'. Cannot find or open the PDB file.
'ConsoleApplication1.exe' (Win32): Loaded 'C:\Windows\SysWOW64\msvcp140d.dll'. Cannot find or open the PDB file.
'ConsoleApplication1.exe' (Win32): Loaded 'C:\Windows\SysWOW64\vcruntime140d.dll'. Cannot find or open the PDB file.
'ConsoleApplication1.exe' (Win32): Loaded 'C:\Windows\SysWOW64\ucrtbased.dll'. Cannot find or open the PDB file.
'ConsoleApplication1.exe' (Win32): Loaded 'C:\Windows\SysWOW64\advapi32.dll'. Cannot find or open the PDB file.
'ConsoleApplication1.exe' (Win32): Loaded 'C:\Windows\SysWOW64\msvcrt.dll'. Cannot find or open the PDB file.
'ConsoleApplication1.exe' (Win32): Loaded 'C:\Windows\SysWOW64\sechost.dll'. Cannot find or open the PDB file.
'ConsoleApplication1.exe' (Win32): Loaded 'C:\Windows\SysWOW64\rpcrt4.dll'. Cannot find or open the PDB file.
'ConsoleApplication1.exe' (Win32): Loaded 'C:\Windows\SysWOW64\sspicli.dll'. Cannot find or open the PDB file.
'ConsoleApplication1.exe' (Win32): Loaded 'C:\Windows\SysWOW64\cryptbase.dll'. Cannot find or open the PDB file.
'ConsoleApplication1.exe' (Win32): Loaded 'C:\Windows\SysWOW64\bcryptprimitives.dll'. Cannot find or open the PDB file.
The program '[9944] ConsoleApplication1.exe' has exited with code 0 (0x0).
It sounds like those are informational messages. One of the answers on this Stack Overflow post suggests running the code using CTRL-F5 instead of only F5 key.