#include <iostream>
#include <cmath>
using namespace std;
int main()
{
string num[21];
int amount_num;
cout<< "How many numbers do you want? (max 20)\n";
cin>> amount_num;
if (amount_num<= 0 || amount_num >= 22)
{
cout << "Invalid size. Ending.\n";
}
for (int counter =0; counter < amount_num; counter++)
{
cout<< "Enter vaule "<< counter<< ":"<< endl;
cin>> num[counter];
}
for(int t= 0; t< amount_num; t++)
{
int total;
int average;
total = total + num[t];
average= total/ t;
cout<< "Average: "<< average<< endl;
}
for(int x=0; x< amount_num; x++)
{
cout<< "You entered:"<< endl;
cout<< num[x]<< endl;
}
}
合計と num[t] を加算しようとすると、エラーが表示され続けます。それは次のように述べています: error no operator+ in total+ num[t].