だから私は基本的に一日中このプログラムを書いていて、多くの繰り返しと問題に取り組んでいて、最終的にそれを終えた後、戻って実行すると、最初に作業していた最も単純な部分が機能しなくなっていることがわかりました。
#include <iostream>
#include <vector>
#include <iomanip>
using namespace std;
void Determine_Output (double);
int main()
{
vector<double> thisVector(10);
double input=-2;
int i=1;
double average = 0.00;
double highest;
double lowest;
cout<<setprecision(3);
for (unsigned z=0; z<10; z++)
{
cout<<"Please enter result \"" <<i<< "\": ";
cin>> input;
if ((input <= 100)&&(input >= 0))
{
thisVector.push_back(input);
Determine_Output(thisVector[i]); //Offending procedure call
i++;
}
else if (input == -1)
break;
else
{
cout<<"Invalid input, must be between 0 and 100\n";
z--;
}
}
void Determine_Output (double output) { //Offending procedure
if (output > 90)
cout<<"A will be assigned to this result\n";
else if (output > 70)
cout<<"B will be assigned to this result\n";
else if (output > 60)
cout<<"C will be assigned to this result\n";
else if (output > 50)
cout<<"P will be assigned to this result\n";
else
cout<<"U will be assigned to this result\n";
}
私が最初にプログラムを書いたとき、これは正常に機能しました (つまり、99 が A を返し、77 が B を返し、66 が C を返しました)。
残りのコード (スペースの都合上省略) が完成したので、実際の入力が何であれ、このセクションは常に U (50 以下の入力) を返します。私は文字通り、この 1 つのパートで 2 時間半働いてきましたが、困惑しています。