You are on page 1of 6

PROGRAM#01

#include <iostream>
#include <cmath>
using namespace std;
int main()
{
int a,b,x,y;
a=b=x=y=0;
a++;
b=a;
++x;
y=x;
cout<<"a="<<a<<endl<<"b="<<b<<endl;
cout<<"x="<<x<<endl<<"y="<<y<<endl;
return 0;

PROGRAM#02

#include<stdafx.h>
#include <iostream>
#include <cmath>
using namespace std;
int main()
{
int a,b,x,y;
a=b=x=y=0;
b=a++;
y=++x;
cout<<"a="<<a<<endl<<"b="<<b<<endl;
cout<<"x="<<x<<endl<<"y="<<y<<endl;
return 0;

PROGRAM#03

#include <stdafx.h>
#include <iostream>
#include <cmath>
using namespace std;
int main()
{
int a,b,x,y;
a=b=x=y=0;
a--;
b=a;
--x;
y=x;
cout<<"a="<<a<<endl<<"b="<<b<<endl;
cout<<"x="<<x<<endl<<"y="<<y<<endl;
return 0;}
PROGRAM#04

(point.h)
#pragma once
class point
{
private:
double xcoord,ycoord,c;
public:
point();
point(double a,double b);
};

(point.cpp)
#include "stdafx.h"
#include "point.h"
#include<iostream>
#include <cmath>
using namespace std;
point::point()
{
cout<<"Constructing point objects"<<endl;
cout<<"Initializing to zero"<<endl;
}
point::point(double a,double b)
{
cout<<"Constructing sum"<<endl;
xcoord=a;
ycoord=b;
c=a+b;
cout<<"Sum is"<<c<<endl;
}

(Main program)

#include "stdafx.h"
#include <iostream>
#include "point.h"
#include <cmath>
using namespace std;
int main()
{
cout<<"In main function(Constructor)#1"<<endl;
point p1;
cout<<"In main function(Constructor)#2"<<endl;
point p2(1.5,-4.7);
cout<<"In main function(Constructor)#3"<<endl;
const point ORIGIN(0.0,0.0);

return 0;
}
(PROGRAM#05)

(point.h)
#pragma once
class point
{
private:
int xcoord,ycoord,c;
public:
point();
point(int a, int b);
};

(point.cpp)
#include "stdafx.h"
#include "point.h"
#include<iostream>
#include <cmath>
using namespace std;
point::point()
{
cout<<"Constructing point objects"<<endl;
cout<<"Initializing to zero"<<endl;
}
point::point(int a,int b)
{
cout<<"Constructing remainder"<<endl;
xcoord=a;
ycoord=b;
c=b%a;
cout<<"Remainder is"<<c<<endl;
}

(Main program)

#include "stdafx.h"
#include <iostream>
#include "point.h"
#include <cmath>
using namespace std;
int main()
{
cout<<"In main function(Constructor)#1"<<endl;
point p1;
cout<<"In main function(Constructor)#2"<<endl;
point p2(27,6);
return 0;
}
PROGRAM#06

(point.h)
#pragma once
class point
{
private:
double xcoord,ycoord,c;
public:
point();
point(int a, int b);
};

(point.cpp)
#include "stdafx.h"
#include "point.h"
#include<iostream>
#include <cmath>
using namespace std;
point::point()
{
cout<<"Constructing point objects"<<endl;
cout<<"Initializing to zero"<<endl;
}
point::point(int a,int b)
{
cout<<"Constructing remainder"<<endl;
xcoord=a;
ycoord=b;
c=b/(double)a;
cout<<"Remainder is"<<c<<endl;
}

(Main program)

#include "stdafx.h"
#include <iostream>
#include "point.h"
#include <cmath>
using namespace std;
int main()
{
cout<<"In main function(Constructor)#1"<<endl;
point p1;
cout<<"In main function(Constructor)#2"<<endl;
point p2(27,6);
return 0;
}
PROGRAM#07

(point.h)
#pragma once
class point
{
private:
double ycoord,xcoord;
int a;
public:
point();
point(double c, double b);
};

(point.cpp)
#include "stdafx.h"
#include "point.h"
#include<iostream>
#include <cmath>
using namespace std;
point::point()
{
cout<<"Constructing point objects"<<endl;
cout<<"Initializing to zero"<<endl;
}
point::point(double c,double b)
{
cout<<"Constructing remainder"<<endl;
xcoord=c;
ycoord=b;
a=b/c;
cout<<"Remainder is"<<a<<endl;
}

(Main program)

#include "stdafx.h"
#include <iostream>
#include "point.h"
#include <cmath>
using namespace std;
int main()
{
cout<<"In main function(Constructor)#1"<<endl;
point p1;
cout<<"In main function(Constructor)#2"<<endl;
point p2(6,18.6);
return 0;
}
PROGRAM#08

(point.h)
#pragma once
class point
{
private:
double a,xcoord;
int ycoord;
public:
point();
point(double c, int b);
};

(point.cpp)
#include "stdafx.h"
#include "point.h"
#include<iostream>
#include <cmath>
using namespace std;
point::point()
{
cout<<"Constructing point objects"<<endl;
cout<<"Initializing to zero"<<endl;
}
point::point(double c, int b)
{
cout<<"Constructing OUTPUT"<<endl;
xcoord=c;
ycoord=b;
a=(int)c/b;
cout<<"OUTPUT___"<<a<<endl;
}

(Main program)
#include "stdafx.h"
#include <iostream>
#include "point.h"
#include <cmath>
using namespace std;
int main()
{
cout<<"In main function(Constructor)#1"<<endl;
point p1;
cout<<"In main function(Constructor)#2"<<endl;
point p2(18.6,6);
return 0;
}

You might also like