Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /*
- Tipuri de date :
- [a] simple
- ( alg. numere prime , ... )
- [b] structurate
- Un tip de date se numeste structurat daca numele lui refera un set de valori
- 1. masive unidimensionale omogene ( vectori )
- ---------------------------
- V : | | | | |
- ---------------------------
- 0 1 2 3 .....
- declarare
- int V[100];
- referire la elemenet prin operatorul de indexare []
- V[3]=3254;
- cout<<V[3];
- Aplicatii :
- A. Algoritmi de ordonare
- 1. Bubble Sort
- --------------
- 2. QuickSort
- 3. HeapSort
- */
- #include<iostream>
- #include<stdlib.h>
- #include<time.h>
- #include<fstream>
- using namespace std;
- int n;
- int V[100];
- int fill_data(int some_array[],int *some_dimension)
- { srand(time(0));
- *some_dimension = rand()%10;
- for ( int i=0;i<*some_dimension;i++) some_array[i] = rand()%1000; return 0;}
- int print_data(int some_array[],int some_dimension)
- {
- fstream output("out.dat",ios::out);
- output<<endl;
- for ( int i=0;i<some_dimension-1;i++) output<<some_array[i]<<" " ;
- output<<some_array[some_dimension-1]; output.close();
- return 0;}
- int main()
- {
- fill_data(V,&n);
- print_data(V,n);
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement