doing tricky function overloading, please help! thank you

Hi there! I'm having a tad bit of trouble with my function overloading code. My code has three different functions: 1) defines the user's symbol, 2) determines the number of columns of the chosen symbol through user input, and 3) determines the number of rows of the chosen symbol through user input. After the code runs through, a rectangle of the specified height and width is supposed to display, made up of the user's symbol. I think I almost have it right (open to any suggestions, lord knows I need 'em!) but I keep getting this error message:


In function 'void DrawBar(char, int, int)':
55:25: error: 'i' was not declared in this scope

--if anyone could please help me fix this, I would SO appreciate it! Thank you!

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
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
  #include <iostream>
using namespace std;
/* run this program using the console pauser or add your own getch, system("pause") or input loop */
    
    
   // int DrawBar(int symbol, int Row, int Column)
    
    void DrawBar(char symbol);
    void DrawBar(char symbol, int Column);
    void DrawBar(char symbol, int Column, int Row);
   /*Draw columns and rows of a symbol*/
  int main()
  {
  		
            char symbol;
            int Column;
            int Row;
      
                cout << "Enter the symbol you would like: ";
                    cin >> symbol;
                cout << "How many rows would you like? ";
                    cin >> Row;
                cout << "How many columns of your symbol would you like? ";
                    cin>> Column;
      
	    DrawBar(symbol);
	    DrawBar(symbol, Column);
    	DrawBar(symbol, Column, Row);
    	
  }
        void DrawBar(char symbol)//function #1
            {
                cout<< symbol<<endl;
            }
  
        void DrawBar(char symbol, int Column)//function #2
            {
                for (int i=0; i<=Column; i++)
                    {
                        cout << symbol;
                        cout <<endl;
                    }
            }
        
        void DrawBar(char symbol, int Column, int Row)//function#3
            {
                do 
                    {
                        for (int i=0; i<=Column; i++)
                            {
                                cout << symbol;
                                cout <<endl;
                            }
                    }
                 while (i<=Row);
            }
Last edited on
The i defined on line 49 does not exist on line 55.
Topic archived. No new replies allowed.