Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // laba_4.3.cpp : Defines the entry point for the console application.
- //
- #include "stdafx.h"
- #include <iostream>
- using namespace std;
- void main()
- {
- cout<<"Vvedite kol-vo elementov massiva: "<<endl;
- int k;
- cin>>k;
- int mas[10000];
- int i;
- for (i=0;i<k;i++)
- {
- cout<<"mas["<<i<<"]="; cin>>mas[i]; //vvod elementov massiva
- }
- int j=0,c=0;
- for (i=1;i<k;i++)
- {
- if(mas[i]<mas[i-1])
- {
- c++;
- }
- /*for(j=0;j<i;j++)
- {
- if(mas[i]<mas[j])
- {
- c++;
- }
- }*/
- }
- cout<<endl<<c<<endl;
- cout<<endl;
- system("pause");
- }
Advertisement
Add Comment
Please, Sign In to add comment