Array incrementation

Hi

I have the following program that fills that array from 0 to 19.
I however want the array to be filled from 0 to 90 in increments of 5.
How do i go about doing this?
note: In the 'i' loop i tried changing it to: (int i=0;i<=90;i+=5), however this does not work.


#include <iostream>

using namespace std;

int main()
{
int arr[20] = {0};

for (int i=0; i<20; i++)
{
arr[i] = i;
}

for(int j=0; j<20; j++)
{
cout << arr[i] << endl;
}

return 0;
}
You can do something like what was posted in this earlier thread.

http://www.cplusplus.com/forum/beginner/127773/#msg691332
oh yes thank you. Sorry for re-posting
The first question was to develop that array.
The second question states: Use a second loop to fill the "sinTheta"and "tanTheta" arrays with sin(x) and tan(x) values where: 0 <= x <= 90 and x increases in steps of 5.

How would I include the upper limits of 90? since sin90=1 which is a valid answer however tan90 is undefined. All of this is supposed to be in one loop i think.
You could check the value of the loop counter before filling the tanTheta array. If you're on the 18th element (5 * 18 = 90), skip the tanTheta assignment.
Topic archived. No new replies allowed.