#include <cstdlib>
#include <iostream>
#include <conio.h>

using namespace std;

void x();
void x(char);
void x(char,int);
void x(char,int,char);
void x(int);
void x(char);

int main(int argc, char *argv[])
{
x();
x('B');
x('E',30);
x('B',30,'E');
x(10);
x('V');
getch();
}

void x()
{
     for(int j=0;j<50;j++)
     cout << '*';
     cout << endl;
     }
void x(char xx)
{
 for(int j=0;j<50;j++)
     cout << xx;
     cout << endl;
     }
 void x(char xx,int yy)
 {
 for(int j=0;j<yy;j++)
     cout << xx;
     cout << endl;
     }
void x(char xx,int yy, char pi)
 {
  for(int j=0;j<yy;j++)
     cout << xx << "."<<pi;
     cout << endl;
     }
     
void x(int yy)
 {
  for(int j=0;j<yy;j++)
     cout << j << ".";
     cout << endl;
     }     
     
 void x(char xx)
{
 for(int j=0;j<50;j++)
     cout << xx;
     cout << endl;
     }

So what exactly is wrong? And your two x(char) functions both do exactly the same thing, so why do you have two of them declared?

This won't compile because function x is having two overloaded versions with same signature -

void x(char)

It should produce an error "Function Re-Declared" .. something like that.

Edited 6 Years Ago by vidit_X: n/a

thank you. I write xx (char) or x(string) it is working. I understand that.

This question has already been answered. Start a new discussion instead.