Generate fibonacci series by overloading explain program in C++

Generate fibonacci series by overloading
(i) prefix increment operator
(ii) postfix increment operator
1)SOURCE CODE ::
#include<iostream.h>
#include<conio.h>
#include<stdio.h>
#include<string.h>
class fib
{
int a,b,c;
public:
fib()
{
a=0;
b=1;
c=a+b;
}
void operator ++()
{
cout<<"\n\n"<<c;
a=b;
b=c;
c=a+b;
}
};
void main()
{
clrscr();
fib obj,obj1;
int i,n;
cout<<"\n\n Enter the no. of term's upto which series is to be displayed : ";
cin>>n;
cout<<0<<"\n\n"<<1;
for(i=0;i<n-2;i++)
{ ++obj;
}
getch();
}
Write an OOP program to overload = = operator to compare two strings.
#include<iostream.h>
#include<conio.h>
#include<stdio.h>
#include<string.h>
class string
{
char s1[20];
public:
void get()
{ cout<<"\n\n Enter any string : ";
gets(s1);
}
int operator ==(string x)
{
int comp;
comp=strcmp(s1,x.s1);
if(comp==0)
return(1);
else
return(0);
}
};
void main()
{
string obj,obj1;
clrscr();
obj.get();
obj1.get();
if(obj==obj1)
{
cout<<"\n\n String's are equal ";
}
else
{
cout<<"\n\n String's are unequal ";
}
getch();
}
Overload the binary operator + using friend function to add two objects.
#include<conio.h>
#include<iostream.h>
class fib
{ int c;
public:
void get()
{ cin>>c;
}
friend fib operator +(fib &,fib &);
void show()
{ cout<<"\nc="<<c;
}
};
fib operator +(fib &x,fib &y)
{ fib z ;
z.c=x.c+y.c;
return(z);
}
void main()
{
clrscr();
fib f1,f2,f3;
f1.get();
f2.get();
f3=f1+f2;
f1.show();
f2.show();
f3.show();
getch();
}
Labels: C++