I'm having trouble with my programming assignment. It's made up of two parts. Part I is a while loop, and part II is a for loop.

The first part counts how many even numbers and how many odd numbers the user types before typing 0. I think I have most of this part complete, but I don't know how to make it determine the odds from the evens. I know I need to use

`if (num%2 == 0)`

, but I don't know where it goes, and what else I need to add.

In the second part, the user types in two temperatures. The first temperature is mulitplied by 5 and it loops until the temperature is greater than or equal to the second temperature. I'm pretty sure this is how I set up the rest of the code, but again I'm not sure where it goes.

```
cout << “ Celsius Fahrenheit” << endl;
cout << “------------------------” << endl;
cout << setw(8) << celsius << setw(8) << fahrenheit << endl;
```

I have part ii set up how it's essentially supposed to be, but I'm having a hard time putting the pieces together.

And here's the code I have written so far:

```
#include<iostream>
using namespace std;
const double fahrenheit = 9.0 / 5 * celsius + 32;
int main()
{
int count = 0, i, j;
char number;
cout << "Enter a non-zero integer (0 to quit): ";
cin >> number;
while (number != '0')
{
count = count + 1;
cout << "Enter a non-zero integer (0 to quit): ";
cin >> number;
}
cout << "-----------------------------------------" << endl;
cout << "Even Count: " << count << endl;
cout << "Odd Count: " << count << endl;
cout << "-----------------------------------------" << endl;
int i, j;
cout << "Enter beginning Celsius temperature: ";
cin >> i;
cout << "Enter ending Celsius temperature: ";
cin >> j;
for(i = 0; i < 11; i++)
{
for(j = 1; j <= i; j++)
cout << "*";
cout << endl;
}
return 0;
}
```

Here's an example of the output:

Enter a non-zero integer (0 to quit): 89

Enter a non-zero integer (0 to quit): 55

Enter a non-zero integer (0 to quit): 56

Enter a non-zero integer (0 to quit): 1

Enter a non-zero integer (0 to quit): 2

Enter a non-zero integer (0 to quit): 0

-----------------------------------------

Even Count: 2

Odd Count: 3

-----------------------------------------

Enter beginning Celsius temperature: 25.891

Enter ending Celsius temperature: 58.111

Celsius Fahrenheit

------------------------

25.891 78.604

30.891 87.604

35.891 96.604

40.891 105.604

45.891 114.604

50.891 123.604

55.891 132.604

I hope this isn't confusing. I appreciate any help I may receive, and I want to let it be known that I hope I can return the favour to other users on this forum because I know how frustrating this is.

Thanks in advance!

*Edited 7 Years Ago by jamesbrad288*: n/a