Quipex icon

Laba_4.3

Quipex | PRO | 10/06/15 04:37:14 AM UTC | 0 ⭐ | 331 👁️ | Never ⏰ | []
C++ |

570 B

|

None

|

0 👍

/

0 👎

// 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");
}

Comments