Hey guys. I ma new to c++ and need a little help.

My teacher gave us an assignment in which we have to take input from the user as to how many integers are to be entered. the program then compares the first integer with the rest,

then it compares the 2nd with the rest excluding the first one. Until it reaches the end. it then displays the num of integers which were smaller than the 1st one, then displays the num of integers smaller than the second one and so on....

for example the num of integers to be entered is 4. and the integers entered are 5,4,2,3.

it will compare 5 to 4,5 to 2 and 5 to 3 and display that 3 numbers were smaller than 5. Next it will compare 4 with 2 and 4 with 3 and display that 2 num were smaller than 4. Next it will compare 2 with 3 and display that 0 numbers were smaller than 2. Finally it will sum these comparison and display the final answer which over here would be 5.

Here is what I have come up with so far.

```
#include <iostream>
using namespace std;
int main()
{
int n=0;
int x=0;
int count=0;
cout<<"enter size of permutation: ";
cin>>n;
int size[n];
for(int j=1;j<=n;j++)
{
cout<<"Enter no."<<j<<" ";
cin>>size[j];
}
for (x=1;x<=n;x++)
{
if(size[1]>size[x])
count++;}
cout<<count<<" inversions for "<<size[1]<<endl;
system("pause");
return 0;
}
```