Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include <fstream>
- #include <ctime>
- #include <cstdlib>
- using namespace std;
- ifstream f("DATE.IN");
- long long int V[1000000];
- int n,i;
- void citire()
- {
- cout<<"n= ";cin>>n;
- for(i=1;i<=n;i++)
- {
- V[i]=(rand()%5000)+1;
- }
- }
- void afisare()
- {
- for(i=1;i<=n;i++)
- cout<<V[i]<<" ";
- }
- void bubblesort(long long int V[], int n) {
- if(n == 1)
- return;
- else {
- int aux;
- for(int i=1; i<n; i++)
- if(V[i] > V[i+1]) {
- aux = V[i];
- V[i] = V[i+1];
- V[i+1] = aux;
- }
- bubblesort(V,n-1);
- }
- }
- /*int poz (int p, int u){
- {
- int piv, k, aux
- }
- }\
- */
- int main()
- {
- citire();
- afisare();
- bubblesort(V, n);
- for(i=1; i<=n; i++)
- cout<< V[i] << " ";
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement