Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- using namespace std;
- int secondMax(int tab[], int size);
- int main()
- {
- int tab[10];
- int size = 10;
- for (int i = 0; i < size; i++) {
- tab[i] = i;
- }
- cout << secondMax(tab,size) << endl;
- }
- int secondMax(int tab[], int size) {
- for (int i = 0; i < size; i++) {
- for (int j = i; j < size; j++) {
- if (tab[i] > tab[j]) {
- int mem = tab[i];
- tab[i] = tab[j];
- tab[j] = mem;
- }
- }
- }
- return tab[1];
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement