debugging

// Debug 6-1
// function counts down from higher number to lower number entered
// e.g., if numbers entered are 4 and 8
// output is: 8 7 6 5 4


what is my mistake here? pls help asap
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
#include<iostream>
using namespace std;

int main()
{
   void countdown(int high, int low);
   int high,low;
   cout << "I will count down from the higher number you enter " <<
      "to the lower one." << endl;
   cout << "Enter a number > ";
   cin >> high;
   cout << "Enter another number > ";
   cin >> low;
   if(high < low)

    swap (high,low);
     
   countdown(high, low);
   return 0;
}
void countDown(int lowest, int highest)
{
   int x;
   for(x = highest; x = lowest; --x)
     cout << x << " " << endl;
}
Last edited on
on line 24: x = lowest should be x >= lowest // Note: >
Topic archived. No new replies allowed.