the frequent answer by the user input didnt match with the out
help please

#include<iostream.>

using namespace std;

int main()

{

int num[7];


cout<<"answer all question.1,2,or 3"<<endl<<endl;


cout<<"QUESTION 1"<<endl<<endl;

cout<<"A)your favourate food?"<<endl<<endl;
cout<<"1)chicken"<<endl;
cout<<"2)fish"<<endl;
cout<<"3)meat"<<endl<<endl;

cin >> num[0];



cout<<"QUESTION 2"<<endl<<endl;

cout<<"A)your favourate drinks?<<endl"<<endl;
cout<<"1)coca-cola"<<endl;
cout<<"2)sprite"<<endl;
cout<<"3)pepsi"<<endl<<endl;

cin >> num[1];



cout<<"QUESTION 3"<<endl<<endl;

cout<<"A)your favourate football team?"<<endl<<endl;
cout<<"1)brazil"<<endl;
cout<<"2)england"<<endl;
cout<<"3)argentina"<<endl<<endl;

cin >> num[2];



cout<<"QUESTION 4"<<endl<<endl;

cout<<"A)your favourate ice-cream flavour?"<<endl<<endl;
cout<<"1)vanila"<<endl;
cout<<"2)chocolate"<<endl;
cout<<"3)strawberry"<<endl<<endl;

cin >> num[3];


cout<<"QUESTION 5"<<endl<<endl;

cout<<"A)your favourate book?"<<endl<<endl;
cout<<"1)novel"<<endl;
cout<<"2)magazine"<<endl;
cout<<"3)education"<<endl<<endl;

cin >> num[4];

cout<<"QUESTION 6"<<endl<<endl;

cout<<"A)your favourate transportation?"<<endl<<endl;
cout<<"1)car"<<endl;
cout<<"2)train"<<endl;
cout<<"3)motocycle"<<endl<<endl;

cin >> num[5];

cout<<"QUESTION 7"<<endl<<endl;

cout<<"A)your favourate color?"<<endl<<endl;
cout<<"1)red"<<endl;
cout<<"2)white"<<endl;
cout<<"3)blue"<<endl<<endl;

cin >> num[6];

cout<<"your frequent answer "<<endl;


int sorted[7];
int N = sizeof(num)/sizeof(num[0]);
int last_change=0;

for (int i=1; i<4; ++i){
int n;
for (n = last_change; n<N && num[n]==i; ++n) {
}
cout << i << " repeted " << (n-last_change) << " times " <<endl;
last_change = n;

}
cout<<"thank you"<<endl<<endl;
system("pause");
return 0;
}