Write a functions that prints the character on the screen .write one function called putchar() that accept no argument and print 30 star(*) on the screen on one line..write one function called putchar() that accept one char variable ch on print that the character on the screen fot 30 times .write another function called putchar() that accept two arguments one char variable ch and second int variable t and print the ch on the screen for t times. write a main () function that gets a value from the user to test these function. use function overloading

1

Answers

2015-08-19T05:24:49+05:30

This Is a Certified Answer

×
Certified answers contain reliable, trustworthy information vouched for by a hand-picked team of experts. Brainly has millions of high quality answers, all of them carefully moderated by our most trusted community members, but certified answers are the finest of the finest.
#include <cstdio>
#include <iostream>
#include <string>

#define N 30

void putChar ();
void putChar (char ch) ;
void putChar (char ch, int t) ;


int main (char *argc[], int argv)
{
    int  t; char c;
        cout << "Type in the char to print: " ;
        cin >> c;
       cout << "type in the number of times it is to be printed : ";
       cin >> t;
       cout << "function without parameters: \n";
       putchar ();
       cout << "function with 1 parameter:\n";
       putchar (c);
       cout << "function with 2 parameters;\n";
      putchar (c, t);
}

void putChar ()
{
     int n;
       for (n = 0; n < N ; n++)  fputc ('*', stdout);
       fputc('\n', stdout);
}

void putChar (char c)
{
     int n;
       for (n = 0; n < N ; n++)  fputc (c, stdout);
       fputc('\n', stdout);
}

void purChar (char c, int t)
{
     int n;
       for (n=0; n < t; n++)  fputc(c, stdout);
       fputc('\n', stdout);
}

1 5 1
click on thanks button above please