Return Styles: Pseud0ch, Terminal, Valhalla, NES, Geocities, Blue Moon. Entire thread

Programming help

Name: General Butt Naked 2012-02-17 19:52

Okay /prog/,

I need some quick help.

http://i.imgur.com/cSAvU.jpg

I got part A done with no problem.

My question is how do I use while and do whiles to store each data set's average and then print it out after a 0 is read.

Here is what I have so far

http://pastebin.com/MuSwgHNv

Thanks

Name: Anonymous 2012-02-17 20:05

You don't need to store data set's averages. Just print them as you finish their calculation.

But, if you insist, just use a list to hold their values.

#include <list>
#include <iostream>

int main() {
  std::list<float> v;
  float avg;
  while (/* exit condition */) {
    /* calculate each dataset's avg */
    v.push_back(avg);
  }
  for (std::list<float>::iterator i = v.begin(); i != v.end(); i++) {
    std::cout << *i << '\n';
  }
}

Newer Posts
Don't change these.
Name: Email:
Entire Thread Thread List