int region_count = 0, month_count;

do
{
 month_count = 0;
 month_count++;
 region_count++
}while(month_count<3 && region_count <4); 
Corey McKee




From: andrew clarke 
Sent: Tuesday, October 21, 2008 6:41 AM
To: [email protected] 
Subject: Re: [c-prog] How would I use the do while statement here?


On Tue 2008-10-21 10:45:45 UTC+0100, Paul Herring ([EMAIL PROTECTED]) wrote:

> On Tue, Oct 21, 2008 at 9:12 AM, April <[EMAIL PROTECTED]> wrote:

> > I have a homework assignment where I have to create a program in C++
> > where the user enters three data amounts on four different occasions
> > (three months sales for four regions). The program adds the region
> > sums, and displays that along with the total for all regions and
> > months. This chapter is on the do while statement and I just don't see
> > where the do while statement would go here. I suppose I could cout <<
> > Enter data; bla, bla, bla while the number is under 0 but if I stop
> > taking data after three entries, I don't see the point.
> 
> int region_count = 0, month_count;
> 
> while(region_count < 4){

But that's a 'while'. The OP wants a 'do..while'. :)

> month_count = 0;
> while(month_count < 3){
> ...
> month_count++;
> }
> ...
> region_count++;
> }


 

[Non-text portions of this message have been removed]

Reply via email to