c++,请问有什么办法输出

建立两个int型的一维数组,分别起名为a和b,并完成以下任务: (1)编制一个判定某数是否为素数的子函数prime;
(2)键盘输入10个数据(这些数中有奇数、也有偶数)存入数组a中;
(3)输出a数组中的最大值和下标,以及输出其最小值和下标;
(4)通过调用子函数prime,找出数组a中所有的素数,并存入数组b中;
(5)反向(即从后b[n-1]到前b[0])输出b中元素,数据域宽为4。
要求:输入输出格式参见样张。
请输入10个正整数:
98 13 45 51 1 2 97 91 17 18
数组中的最大值为:98,其下标为0 数组中的最小值为: 1,其下标为4 素数为:17 97 2 13
请按任意键继续.

#include <iostream>
#define N 10
using namespace std;

//判断素数
bool isPrime(int num) {
    int a = 0;  // 素数的个数

    for (int i = 2; i < num; i++) {
        if (num%i == 0) {
            a++;  // 素数个数加1
        }
    }
    if (a == 0) 
        return true;
    else 
        return false;
}

//返回最大值的下标
int Maxindex(int a[], int n) {
    int maxindex = 0;
    int max = a[0];
    for (int i = 0; i < n; i++) {
        if (a[i] > max) {
            max = a[i];
            maxindex = i;
        }
    }
    return maxindex;
}

//返回最小值的下标
int Minindex(int a[], int n) {
    int minindex = 0;
    int min = a[0];
    for (int i = 0; i < n; i++){
        if (a[i] < min) {
            min = a[i];
            minindex = i;
        }
    }
    return minindex;
}


int main()
{
    int a[N] = { 0 };
    int b[N] = { 0 };
    cout << "请输入N个数:" << endl;
    for (int i = 0; i < N; i++)
    {
        cin >> a[i];
    }
    int j = 0;
    for (int i = 0; i < N; i++) {
        if (isPrime(a[i]) == true) {
            b[j] = a[i];
            j++;
        }
    }//存质数
    cout << "数组中的最大值为:" << a[Maxindex(a, N)] << ",其下标为" << Maxindex(a, N) << " " \
        << "数组中的最小值为:" << a[Minindex(a, N)] << ",其下标为" << Minindex(a, N) << " " \
        << "素数为:" ;
    for (int i = N-1; i >= 0; i--)
    {
        if (b[i] != 0)
        {
            cout << b[i] << " ";
        }
    }
}