Facebook
From Whipped Terrapin, 7 Years ago, written in C++.
This paste is a reply to C++ from Whipped Partdridge - go back
Embed
Viewing differences between C++ and Re: C++
#include 
#include 
#include 
using namespace std;

int main()
{   
    int buf;
    int n;
    int tab[10000];
    cout << "Podaj ilosc liczb w tablicy:" << endl; 
    cin >> n;
   if (n>0){
   
     cout << "Elementy tablicy: ";
    for (int i = 0; i < n; i++)
    {
        tab[i] = rand() % 100;
        cout << setw(4) << tab[i];
        if (tab[i]>tab[i + 1])
        {
            buf = tab[i];
            tab[i] = tab[i + 1];
            tab[i + 1] = buf;
            
 
        }   
                cout << " Elementy tablicy: ";
for (int i = 0; i < n; i++)
cout << setw(4) << tab[i];
cout << endl;  
    } 
        cout << endl;
}
else 
cout << "Uwaga! Podales niewlasciwa liczbe (ujemna)"<< endl;
    system("PAUSE");
    return 0;
}