of n numbers I suppose ....
tick tick tick
voila finished i just did it
2007-02-23 19:38:16
·
answer #1
·
answered by gjmb1960 7
·
0⤊
0⤋
Don't you mean given set of numbers?
2007-02-23 18:52:28
·
answer #2
·
answered by Anonymous
·
0⤊
0⤋
enter validation is an considerable portion of this task, so earnings from it. The technique for show and summing of digits is comparable, so as that they could be blended. using separate applications, despite the fact that, makes them extra reusable - you will possibly be able to discover a desire for those in destiny classes. this ought to provide you some techniques for a thank you to jot down your application: #comprise iostream #comprise string #comprise sstream #comprise typeinfo using namespace std; template void getInput(T *in, bool (*)(T&)); bool isPositiveInt(int&); void explodeReverse(unsigned); unsigned sumDigits(unsigned); int considerable(int argc, char *argv[]) { int n; on a similar time as (actual) { cout << "enter a favorable integer: " << endl; getInput(&n, isPositiveInt); explodeReverse(n); cout << "sum to " << sumDigits(n) << endl << endl; } return 0; } unsigned sumDigits(unsigned n) { if (n < 10) return n; return (n % 10) + sumDigits(n / 10); } void explodeReverse(unsigned n) { cout << n % 10 << " "; if (n > 9) explodeReverse(n / 10); } bool isPositiveInt(int &i) { return i > 0; } template void getInput(T *in, bool (*valid)(T&)) { stringstream ss; string line; bool inputOk = fake; cout << "> "; do { getline(cin,line); ss.sparkling(); ss.str(line); if (inputOk = (ss >> *in)) { if (typeid(*in) == typeid(char)) { ss.forget approximately approximately(); } inputOk = valid(*in) && !ss.reliable(); } if (!inputOk) { cout << "invalid enter, try lower back" << endl << "> "; } } on a similar time as (inputOk == fake); } #if 0 pattern run: enter a favorable integer: > -a million invalid enter, try lower back > invalid enter, try lower back > x invalid enter, try lower back > 19683 3 8 6 9 a million sum to 27 #endif
2016-10-16 09:14:25
·
answer #3
·
answered by ? 4
·
0⤊
0⤋
#include
using namespace std;
int main()
{
cout << "Enter your number" << endl;
int number;
cin >> number;
cout << " Minimum = " << number << endl << "Maximum = " << number << endl << "Mean average = " << number << endl;
system("pause");
return 0;
}
2007-02-23 21:32:20
·
answer #4
·
answered by Anonymous
·
0⤊
0⤋
If you can't do this on your own, you should really consider choosing a different course/major.
2007-02-23 18:45:24
·
answer #5
·
answered by screaminhangover 4
·
1⤊
0⤋
is that a question,... a demand...or your homework?
2007-02-23 18:44:32
·
answer #6
·
answered by Anonymous
·
1⤊
0⤋