For Loop Display?

Oct 11, 2015 at 7:21pm
Im trying to get two for loops to display thier iterations side by side but I don't get the wanted results.

By trying

cout << x << "--------" << y << endl; // I tried to use this to display both iterations of the two loops to display the first loop and then the 2nd loop. But the for loops break by repeating the same number.



1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
  #include <iostream>
#include <cstdlib>
#include <iomanip>
using namespace std;
int main()
{

    int x;
    float y;  

    cout << "Passengers - Ticket Price" << endl;

    for (x = 210; x <=500; x+=10)
        cout << x << endl;


    for (y = 30.00; y >= 14.00; y -=.50)
        cout << y << endl;

}
Oct 11, 2015 at 7:52pm
for(x = 210, y = 30.0; x <= 500 && y >= 14.0; x += 10, y -= 0.5)
Oct 11, 2015 at 7:56pm
Thanks you so much for you help..You just helped me ALOT.
Topic archived. No new replies allowed.