Skip to content

Instantly share code, notes, and snippets.

@invatainfo
Last active September 20, 2017 09:55
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save invatainfo/7ed4583c61a04dd87831f2976423bace to your computer and use it in GitHub Desktop.
Save invatainfo/7ed4583c61a04dd87831f2976423bace to your computer and use it in GitHub Desktop.
#include <fstream.h>
int main() {
int v[100], n = 0, x, i, j, aux;
n = 0;
ifstream fin("nr.txt");
while (fin >> x) {
if (x >= 100) {
v[n] = x;
n = n + 1;
}
}
if (n == 0)
cout << "nu exista";
else
for (i = 0; i <= n - 2; i++)
for (j = i + 1; j <= n - 1; j++) {
if (v[i] > v[j]) {
aux = v[i];
v[i] = v[j];
v[j] = aux;
}
}
for (i = 0; i <= n - 1; i++)
cout << v[i] << " ";
return 0;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment