Hi, I am new to c++.
I'm having troble with displaying ODD number in give range.
Plz help me!
when I input odd number at first, it will compile correctly. BUT when I put even, it will display even numbers.... how can i fix it??
Here's my code so far.
#include <iostream>
usingnamespace std;
int main()
{
double x,y;
while (true)
{
cout << endl << "Enter the starting point of the range (double): ";
cin >> x; cin.ignore(80, '\n');
cout << "Enter the ending point of the range (double): ";
cin >> y; cin.ignore(80, '\n');
while(y <= x)
{
cout << "Your ending number must eb greater than your starting number.\n"
<< "Please try a new ending number: ";
cin >> y; cin.ignore(80, '\n');
}
for (int count = x; count <=y ; count += 2)
cout << count << " ";
}