I have a structure array (A[#]) named Sheep (since my task is about sheeps DNR). After I do whatever the task asked I am left with this struct :

```
struct Sheep 
{
    string Vardas;
    char Fragmentas[CMax]; 
    int atitikme = 0; 
};

```

and inside my it the data is:

```
(string Vardas) | (char Fragmentas[CMax]) | (int atitikme)
Baltukas   TAGCTT 3
Bailioji   ATGCAA 3 
Smarkuolis AATGAA 1 

```

(char Fragmentas[CMax] won't be using so u don't have to look at it, I only named it to make it clear).

ALL of this data comes from U2.txt file and cant be manually typed in a code.

All its left to do is to sort it by these rules:

> 
> 1. It goes from bigger to smaller by 'int atitikme'.
> 2. IF 'int atitikme' is equal then it will have to sort by 'A[#].Vardas in a in alphabetical order.
> 
> 
> 

To sort it by 'int atitikme' I created a code:

```
string q;
char w[20];
int e;
for (int o = 0; o < n-1; o++) 
{
    for (int p = o+1; p < n-1; p++) 
    {
        if (A[p].atitikme > A[o].atitikme) 
        {
            // - Vardo Keitimas
            q = A[o].Vardas;
            A[o].Vardas = A[p].Vardas;
            A[p].Vardas = q;
            // - A[#].atitikme keitimas
            e = A[o].atitikme;
            A[o].atitikme = A[p].atitikme;
            A[p].atitikme = e;
            // - DNR farkmentu keitimas
            for (int r = 0; r < m; r++) 
            {
                w[r] = A[o].Fragmentas[r];
                A[o].Fragmentas[r] = A[p].Fragmentas[r];
                A[p].Fragmentas[r] = w[r];
             }
        }
    }
}

```

n = 4 | m = 6

How/what do i need to add to this code to make it go:

```
else if (A[p].atitikme == A[o].atitikme) 
{
    <code>
}

```

That if 'atitikme' is == to another 'atitikme' then A[p].Vardas and A[o].Vardas has to be sorted in an alphabetical order. but only those 2 from the whole array.

OR if its too hard to understand what I meant, could anyone post a code, in the answer box, were it would sort in a alphabetical order between 2 string's?

NOTE:
the whole line data

> 
> (string Vardas) (char Fragmentas[CMax]) (int atitikme)
> 
> 
> 

has to stay the same, only the place in the line has to be diffirent and sorted by those rules I mentioned before.

The output should be:

```
Bailioji   3
Baltukas   3
Smarkuolis 1

```

EDIT:
My current output is:

```
Baltukas   3
Bailioji   3
Smarkuolis 1

```

**P.s**. The task allows to use everything as-long as its C++ and does not have to create, or read, any other file.