Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.c++ > #12476
| From | "MikeWhy" <boat042-nospam@yahoo.com> |
|---|---|
| Newsgroups | comp.lang.c++ |
| Subject | Re: Issues with combo of structures and arrays - Practice for a final exam |
| Date | 2011-12-13 18:18 -0600 |
| Organization | A noiseless patient Spider |
| Message-ID | <jc8pvt$cm$1@dont-email.me> (permalink) |
| References | <18071799.15.1323818090821.JavaMail.geo-discussion-forums@yqnd19> |
Kebin wrote:
> Hey how's it hanging? I'm a student at PSU and I don't molest
> children. Maybe you can help me finish my code - it implements pretty
> much everything I need to know for my final tomorrow so help is much
> appreciated!
>
> http://www.mediafire.com/?x5and7k92cs0wa4
>
> There a link to what I've done so far, and if you're sketched about
> downloading it go ahead and scan a million times and know that its
> just a cpp file which idk if you can even get viruses on those?
> Anyway check it out - the one problem I have currently is that the
> last function
>
> void AverageTotal (Book index[],int s,double avg,double sum)
> {
> int i;
>
> for (i=0; i<s; i++)
> {
> sum = sum + index[i].cost;
> }
> avg = sum / i+1;
> }
>
> That is designed to find avg and total of the books is not returning
> anything but 0. Maybe you can find out why?!
>
> Anyway, thanks for your time and potential help.
>
> Good day to youuzzz
maybe try:
double AverageTotal (Book index[],int s)
{
double sum = 0.0;
...
return sum / s;
}
or
void AverageTotal (const Book index[],int s, double & avg, double & sum)
{
avg = sum = 0.0;
...
Back to comp.lang.c++ | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
Issues with combo of structures and arrays - Practice for a final exam Kebin <k.dulce.21@gmail.com> - 2011-12-13 15:14 -0800 Re: Issues with combo of structures and arrays - Practice for a final exam "MikeWhy" <boat042-nospam@yahoo.com> - 2011-12-13 18:18 -0600 Re: Issues with combo of structures and arrays - Practice for a final exam Christopher <cpisz@austin.rr.com> - 2011-12-14 00:00 -0800 Re: Issues with combo of structures and arrays - Practice for a final exam Tobias Müller <troplin@bluewin.ch> - 2011-12-14 09:53 +0000 Re: Issues with combo of structures and arrays - Practice for a final exam David Harmon <source@netcom.com> - 2011-12-14 07:47 -0800 Re: Issues with combo of structures and arrays - Practice for a final exam 88888 Dihedral <dihedral88888@googlemail.com> - 2011-12-15 08:51 -0800
csiph-web