so I am trying to come up with a firefighting system for my science fair project and one of the main things that come with trying to do so is the coding. it is still in the early stages but for the final product of what I have so far, the code is unnecessarily repeating itself, and I don't know how to stop it. this is the code, so please, if you answer it, paste the fixed code and tell me what is wrong so I don't run into it later. code:
#include <fstream>
using namespace std;
int main() {
int ave = 0;
int num;
//begins ave and basic info being collected
cout << "how many sensors will there be: " << endl;
cin >> num;
int sen[num];
cout << "enter the heat on the sensors in order: " << endl;
for( int i=0; i<num; i++ ){
cin >> sen[i];
ave = ave + sen[i];
}
ave = ave / num;
cout << ave << endl;
//end of basic info/average
bool sens[num];
for( int i=0; i<num; i++ ){
if( sen[i] + 60 > ave ){
sens[i] = 1;
}
}
for( int i=0; i<num; i++ )
if( sens[i] == 1 ){
cout << "there is a fire at sensor" << sens[i] << endl;
}
}
}