C++ functions that takes multiple numbers and perform different jobs -


i have exercise should input multiple numbers finish 0 , perform different calculations them. far have created do..while-loop storing numbers. i´ve been told possible without array, if that´s wrong please tell me right away. functions need add numbers together, locate highest number , second highest number, , mid (mean) value of numbers. think there different libraries should use , there may different options also. please me understand different libraries , how use them. search results i´ve found on the web not give me answers i´m looking because not find similar problem mine. code far:

#include<iostream> #include<string>  using namespace std;  int sumcalc (int); int midvalcalc (int); int sechighcalc (int); int highestcalc (int); void printcalc ();   int main()  {      int nums;     cout << "input numbers, quit 0: ";      {         cin >> nums;         cout << nums << " ";    // see result         }     while (nums != 0);      return 0; } 

what wrong add function?

int sumcalc (int total)   {  total = 0; while (nums != 0) {     total += nums; }  return nums; 

}

i don't think need unusual libraries this.

think how you'd calculate these things mentally. example, if want sum list of numbers read off you, you'd keep track of running total, , forget each number added - needs 1 variable. if want keep track of greatest number entered, again, remember biggest 1 you've seen far , compare new numbers them.

you can solve these.


Comments