I have not worked with the debugger at all and I have a assignment to debug a program.
I don't want just the answer I need help using the debugger.
Correct the Logical errors in the code so that the output of the program appears as such:

*
**
***
****
*****

Code:

/******************************************************************
* Programmer: [Rodney Garner]
*
* Date: [03/11/2011]
*
* Course: COMP 220
*
* Assignment: Identification and correction of logical errors
*
* Description: this program prints a triangle with a base of five asterisks 
*  
* Output: screen - displays a triangle 
* 
********************************************************************/ 

#include <iostream>

int drawBar(int);

int main()
{
     std::cout << std::endl << "Let's Draw a triangle!\n";

     //determine how many lines will be drawn
     int triangleBase = 0;

     //draw the triangle 
     for (int i = 0 ; i >= triangleBase ; i--) {
         drawBar(i);
     }

     return 0;
} //end main

int drawBar(int barSize) {
//draws a line of asterisks
//the number of asterisk drawn equals barSize

     int theCounter = 0;
     while (theCounter >= barSize) {
          theCounter--;
          std::cout << '*';
     }
     std::cout << '\n';
     return 0;
} //end drawBar

Take a good look at the for loop from line 29.If i is 0 and triangleBase is also 0 at the start of the loop .. well the loop just won't start.
After that at line 41 the while loop says that barSize must be a negative integer or zero in order that the loop should start which doesn't make sense in the context in which you want a sequence of one to five iterations.Just set the conditions properly.

commented: That's more like it! +7

Ok so start the debugger and step through the code. If you never used it before get someone to walk you through it...

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.