#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;
     }

Recommended Answers

All 3 Replies

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.

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

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.