I am working on a game. Its a grid on a gnu plot that. that reads in 4 different
ID: 3534125 • Letter: I
Question
I am working on a game. Its a grid on a gnu plot that. that reads in 4 different inputs and averages them within set ranges. Something moves from 1 end of the gnuplot to the other. As it moves across grid (pressure(double), heat(int), sound(double), and vibration(int)) are being read in and stored. then Averaged.
I am not sure how I would get it to read in 4 different types of inputs. i.e. 2 sets are doubles and the other 2 are ints. How would I get all the numbers to be read in and stored. Then be able to average the 4 sets
Explanation / Answer
try....
int heat,vibration;
double sound,pressure,average;
cin>>pressure>>heat>>sound>>vibration;
average=(pressure+heat+sound+vibration)/4;
this will give average as double in value.. :)
Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.