Docstoc

26

Document Sample
26 Powered By Docstoc
					#include<fstream.h> #include<conio.h> void main() {clrscr(); ifstream f("nr.in"); int n,i,j,k; long int numere[10],min,man; cout<<"cate numere vreti sa sortati? "<<endl; cin>>n; for(i=1;i<=n;i++)f>>numere[i]; for(i=1;i<n;i++) {min=numere[i];k=i; for(j=i+1;j<=n;j++) {if(numere[j]<min) {min=numere[j]; k=j;}} man=numere[k]; numere[k]=numere[i]; numere[i]=man;} ofstream fo("nr.out"); for(i=1;i<=n;i++)fo<<numere[i]<<" ";}


				
DOCUMENT INFO
Shared By:
Categories:
Tags:
Stats:
views:26
posted:10/30/2008
language:
pages:1