I am new in C++ and writing a program in C++ using array and queue. I have a problem. while i am inserting data in to array there is no problem but when i try to display data it shows no of array elements correctly but not show data it shows empty. Please help me about this. whether i declaring array in wrong way or any thing else here my both functions below. thanks in advance
#include <iostream>
#include<conio.h>
#include<stdlib.h>
#include<Windows.h>
#include<string>
#include<bits/stdc++.h>
#define MAX_SIZE 100
using namespace std;
class Candidate {
private:
int roll_no, i;
string name,last_degree;
char gender;
int arr_roll[MAX_SIZE];
string arr_name[MAX_SIZE];
string arr_last_degree[MAX_SIZE];
char arr_gender[MAX_SIZE];
int rear;
int front;
public:
Candidate() {
rear = 0;
front = 0;
}
void insertIntoQ() {
char a;
do{
cout << "\nEnter The Roll No : ";
cin>>roll_no;
cout << "\nEnter Name of Student";
cin>>name;
cout<< "\n Enter Gender M/F";
cin>>gender;
cout<<"\nEnter Last Degree";
cin>>last_degree;
arr_roll[rear++] = roll_no;
arr_name[rear++] = name;
arr_gender[rear++] = gender;
arr_last_degree[rear++] = last_degree;
cout<<"\n Do you want to continue y/n: ";
cin>>a;
}while(a=='y'||a=='Y');
}
void display_invigilator_m() {
cout << "\n## Queue Size : " << (rear - front);
for (i = front; i < rear; i++){
if(arr_gender[i] == 'm'){
cout<<"\nRoll No : "<<arr_roll[i];
cout<<"\nName : "<<arr_name[i];
cout<<"\nGender : "<<arr_gender[i];
cout<<"\nLast Degree : "<<arr_last_degree[i];
}
}
}
};
these functions for insert and display data. i am calling these functions in main function please help me