Sort2

#include <fstream> #include <algorithm> #include <cstring> using namespace std; ifstream cin("sort2.in"); ofstream cout("sort2.out"); int n,v[105]; void citire(int &n,int x[]){ n=0; long long aux; while(cin>>aux){ if(aux>=0&&aux<=99){ x[aux]++; } } } bool ok=0; int main(){ citire(n,v); for(int i=0;i<=100;i++){ if(v[i]!=0){ ok=1; while(v[i]!=0){ cout<<i<<' '; v[i]--; } } } if(ok==0) cout<<"NU EXISTA"; return 0; }

Be the first to comment

You can use [html][/html], [css][/css], [php][/php] and more to embed the code. Urls are automatically hyperlinked. Line breaks and paragraphs are automatically generated.