Ask User Function Would Like Recall Values Would Like Use Int N Char C Bool O Following Pr Q37217722

How do I ask the user which function they would like to recalland what values they would like to use for int n, char c, or boolo?

Write a C++ program that: 1. 2. Includes a function printChar(int n, char c) that outputs n copies of a given symbol c. Inclu

I have the following program done already:

#include <iostream>

using namespace std;

void printChar(int n,char c)
{
for(int i=0;i<n;i++)
{
if(c==’ ‘)
cout<<” “;
else
cout<<c;
}
//cout<<endl;
}

void printTriangle(int n, char c,bool o)
{
int e=1;
int temp_count=0;
if(o == false){
for(int a=1;a<=n;a++)
{
temp_count = (n)- a;
printChar(temp_count,’ ‘);

temp_count = e;
printChar(temp_count,c);

printChar(1,’n’);
e=e+2;
}
}

else
{
for(int i = n-1; i >= 1; i–)
{
//for loop to put space
temp_count = n-i;
printChar(temp_count,’ ‘);

temp_count =

OR
OR

Leave a Comment

This site uses Akismet to reduce spam. Learn how your comment data is processed.