English Deutsch Français Italiano Español Português 繁體中文 Bahasa Indonesia Tiếng Việt ภาษาไทย
All categories

computes the ave of the lowest and highest numbers

2006-08-07 06:04:29 · 6 answers · asked by bonilso 1 in Computers & Internet Programming & Design

6 answers

Off the top of my head

include
main{
int[10] n;

cout << "enter ten numbers" << endl;
for (int i = 0; i < 10; i+=2)
{
cin >> n[i]
}

int biggest = 99999, littlest = -999999;

for (int j = 0; j < 10; j++)
{
if n[j] < littlest
littlest = n[j]
else if n[j] < biggest
biggest = n[j]
}

int avg = biggest + littlest /2;
cout << avg >> endl;
}

2006-08-07 06:32:58 · answer #1 · answered by Steve S 4 · 1 0

yes, yes I can. Actually you know I was assigned to do the same assignment in my class, so no, no I wont. My services don't come free, you pay like everyone else.

BTW, it really doesn't take an expert to make a program that is that simple.

2006-08-07 06:09:26 · answer #2 · answered by D 4 · 0 0

And you think I should do the learning for you why? And who will be there to do your work after graduation so you can file your nails, surf the web and pick up your paychecks for nothing? Do it yourself.

2006-08-08 05:53:14 · answer #3 · answered by griz803 5 · 0 0

the question is too difficult for an ordinary c++ expert. try mailing it to bill gates

2006-08-07 07:37:15 · answer #4 · answered by TruthIsGod 2 · 0 0

anyone can write a simple progran like that, the question is, can you do it in O(log(n)) time?

Steve S - Good one!

2006-08-07 06:21:35 · answer #5 · answered by p0 3 · 0 0

C'mon man do your own homework

2006-08-07 07:11:07 · answer #6 · answered by uscmedguy 3 · 0 0

fedest.com, questions and answers