Jump to content

Vova

Members
  • Content Count

    1
  • Joined

  • Last visited

Community Reputation

0 Neutral

About Vova

  • Rank
    User Nou
  1. Sa se ordoneze crescator/descrescator un sir de n numere naturale. Cine ma poate ajuta sa gasesc gresela? #include <iostream> #include <conio.h> using namespace std; int main() { int s[100], n, i, j, tmp = 0; cout << "Numarul de componente in vector sunt: "; cin >> n; for (i = 0; i < n; i++) { cout << "s[" << i << "]="; cin >> s; } for (j = 1; j <= n; j++) { for (i = 0; i = n - 1; i++) { if (s > s[i + 1]) { tmp = s; s = s[i + 1]; s[i + 1] = tmp; } } } for (i = 0; i < n; i++) { cout << s << endl; } _getche(); return 0; }
×
×
  • Create New...