I do not understand what I am doing wrong... I need the second triangle to print the character the user inputs, but instead - and I have no clue as to why it is doing this - it prints the second triangle with smiley faces and other symbols.
Any help would be appreciated, or an explaination to where I am making this happen so I can figure it out and get it to print the users character in the second triangle.
#include "stdafx.h"
#include <iostream>
using namespace std;
void printTriangle(int);
void drawBar(int);
void drawBar(int, char);
int main()
{
int base(0);
char sign(' ');
cout << "This program draws a Triangle" << endl;
cout << "\nEnter the triangle base size: ";
cin >> base;
cout << "\nEnter a character: ";
cin >> sign;
printTriangle(base);
}
void printTriangle(int bs)
{
for(int i = 0; i <= bs; i++)
{
drawBar(i);
cout << endl;
}
for(int i = 0; i <= bs; i++)
{
drawBar(i,i);
cout << endl;
}
cout << endl;
system("PAUSE");
}
void drawBar(int b)
{
for(int i = 0; i < b; i++)
{
cout << "*";
}
}
void drawBar(int b, char ch)
{
for(int i = 0; i < b; i++)
{
cout << ch;
}
}