Last active
September 20, 2017 09:55
-
-
Save invatainfo/7ed4583c61a04dd87831f2976423bace to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#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