我的循环似乎坏了

My Loop seems to be broken

我的循环没有打印它的第 6 个条目。

它应该显示 0 4 0 在线,但它只是跳过它。

#include "stdafx.h"
#include <iostream>
using namespace std;

const int NUMPLANTTYPES = 7;

int main()
{
    double PlantNumbers[NUMPLANTTYPES] = {25, 56, 44, 120, 16, 0, 15};
    int PotSize[NUMPLANTTYPES] = {3, 4, 1, 2, 3, 4, 1};
    double TotalCosts[NUMPLANTTYPES] = { 10, 10, 3.5, 6.99, 10, 10, 3.5 };

    cout << "PlantSold\t PotSize\tTotalCosts " << endl;
    for (int MAXSALES = 0; MAXSALES < 7; MAXSALES++)
    {
        if (PlantNumbers[MAXSALES] > 8) 
        {
            float TotalCost = (PlantNumbers[MAXSALES] * TotalCosts[MAXSALES]);

            cout << PlantNumbers[MAXSALES] << "\t\t " << PotSize[MAXSALES] << "\t\t  " << TotalCost << endl;
        }
    }

    int a;
    cin >> a;

    return 0;
}

如有任何帮助,我们将不胜感激!

My loop won't print its 6th entry, any help?

是的,因为 PlantNumbers[5] 等于 0 并且因为:

    if (PlantNumbers[MAXSALES] > 8)