Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <stdio.h>
- #include <iostream>
- using namespace std;
- void monitor(int *p, int n);
- ///////////////////////////////////////////////////
- int main()
- {
- setlocale(0, "rus");
- int nArr[20] = {103, 101, 5, 999, 12, 667, 2, 9, 3, 7, 10, 221, 15, 959, 72, 67, 82, 93, 333, 17};
- int nFlag = 0,
- n;
- L_01:
- for(int i = 0; i < 19; i++)
- {
- if(nArr[i] > nArr[i+1])
- {
- n = nArr[i];
- nArr[i] = nArr[i+1];
- nArr[i+1] = n;
- nFlag = 1;
- }
- }
- if(nFlag == 1)
- {
- nFlag = 0;
- goto L_01;
- }
- monitor(nArr, 20);
- }
- ////////////////////////////////////////////////////
- void monitor(int *p, int n)
- {
- for(int i = 0; i < n-1; i++)
- {
- cout << p[i] << ", ";
- }
- cout << endl;
- }
- /*
- #include <stdio.h>
- #include <iostream>
- using namespace std;
- ///////////////////////////////////////////////////
- int main()
- {
- setlocale(0, "rus");
- int nArr[10] = {100, 101, 5, 999, 12, 667, 2, 9, 3, 7};
- int nMin = nArr[0],
- nCount = 0;
- for(int i = 0; i < 10; i++)
- {
- if(nMin < nArr[i])
- {
- nMin = nArr[i];
- nCount = i;
- }
- }
- cout << "Индекс максимального элемента = " << nCount << endl;
- }
- */
- /*
- #include <stdio.h>
- #include <iostream>
- using namespace std;
- ///////////////////////////////////////////////////
- int main()
- {
- setlocale(0, "rus");
- int nArr[10] = {100, 101, 5, 999, 12, 667, 2, 9, 3, 7};
- int nMin = nArr[0],
- nCount = 0;
- for(int i = 0; i < 10; i++)
- {
- if(nMin > nArr[i])
- {
- nMin = nArr[i];
- nCount = i;
- }
- }
- cout << "Индекс минимального элемента = " << nCount << endl;
- }
- */
- /*
- #include <stdio.h>
- #include <iostream>
- using namespace std;
- ///////////////////////////////////////////////////
- int main()
- {
- setlocale(0, "rus");
- if(79789798)
- {
- // cout << "Привет - Hello ! " << LC_ALL > -7 << endl;
- printf("true = %d", true);
- }
- else printf("False\n");
- return 0;
- }
- */
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement