c++ - Finding the closest number of array to another given number -


i have program write have array of 11 numbers entered me. need find avarage sum of numbers, , im asked find closest number of array avarage sum, , distant element of array avarage sum again. far manage write program create array , find avarage sum. asssume there abs function of cmath libary , far fail make it.

#include <iostream>   using namespace std;  int main() {   unsigned const int size = 11; float number[size];  (unsigned = 0; i<size; i++) {     cout << "please enter value number  "         << + 1 << ":";     cin >> number[i]; } (unsigned = 0; i<size; i++) {     cout << "number " << + 1 << " : "         << number[i] << endl; } unsigned int sum = 0; (unsigned = 0; i<size; i++) {     sum += number[i]; } 

what problem? not asking question, making statement... seem have not posted whole code..

in c++ use "abs" should use fabs "math.h" library!


Comments

Popular posts from this blog

javascript - Slick Slider width recalculation -

jsf - PrimeFaces Datatable - What is f:facet actually doing? -

angular2 services - Angular 2 RC 4 Http post not firing -