#include <iostream>
using namespace std;
class student
{
private:
float a;
float b;
public:
student()
{
}
student(float x,float y)
{
a=x;
b=y;
}
friend student sum(student,student);
void display(student);
};
student sum(student c1,student c2)
{
student c3;
c3.a=c1.a+c2.a;
c3.b=c1.b+c2.b;
return (c3);
}
void student::display(student k)
{
cout<<"The resultant is="<<k.a<<" + j"<<k.b<<endl;
}
int main()
{
student ob2[1000],t;
float x,y,d,z;
int n;
while(cin>>n)
{
for(int i=0;i<n;i++)
{
cin>>x>>y;
student ob(x,y);
cin>>d>>z;
student ob1(d,z);
ob2[i]=sum(ob,ob1);
}
for(int i=0;i<n;i++)
{
t=ob2[i];
ob2[i].display(t);
}
}
return 0;
}
#include <iostream>
using namespace std;
class student
{
private:
float a;
float b;
public:
student()
{
}
student(float x,float y)
{
a=x;
b=y;
}
friend student sum(student,student);
void display(student);
};
student sum(student c1,student c2)
{
student c3;
c3.a=c1.a+c2.a;
c3.b=c1.b+c2.b;
return (c3);
}
void student::display(student k)
{
cout<<"The resultant is="<<k.a<<" + j"<<k.b<<endl;
}
int main()
{
student ob2[1000],t;
float x,y,d,z;
int n;
while(cin>>n)
{
for(int i=0;i<n;i++)
{
cin>>x>>y;
student ob(x,y);
cin>>d>>z;
student ob1(d,z);
ob2[i]=sum(ob,ob1);
}
for(int i=0;i<n;i++)
{
t=ob2[i];
ob2[i].display(t);
}
}
return 0;
}
using namespace std;
class student
{
private:
float a;
float b;
public:
student()
{
}
student(float x,float y)
{
a=x;
b=y;
}
friend student sum(student,student);
void display(student);
};
student sum(student c1,student c2)
{
student c3;
c3.a=c1.a+c2.a;
c3.b=c1.b+c2.b;
return (c3);
}
void student::display(student k)
{
cout<<"The resultant is="<<k.a<<" + j"<<k.b<<endl;
}
int main()
{
student ob2[1000],t;
float x,y,d,z;
int n;
while(cin>>n)
{
for(int i=0;i<n;i++)
{
cin>>x>>y;
student ob(x,y);
cin>>d>>z;
student ob1(d,z);
ob2[i]=sum(ob,ob1);
}
for(int i=0;i<n;i++)
{
t=ob2[i];
ob2[i].display(t);
}
}
return 0;
}
#include <iostream>
using namespace std;
class student
{
private:
float a;
float b;
public:
student()
{
}
student(float x,float y)
{
a=x;
b=y;
}
friend student sum(student,student);
void display(student);
};
student sum(student c1,student c2)
{
student c3;
c3.a=c1.a+c2.a;
c3.b=c1.b+c2.b;
return (c3);
}
void student::display(student k)
{
cout<<"The resultant is="<<k.a<<" + j"<<k.b<<endl;
}
int main()
{
student ob2[1000],t;
float x,y,d,z;
int n;
while(cin>>n)
{
for(int i=0;i<n;i++)
{
cin>>x>>y;
student ob(x,y);
cin>>d>>z;
student ob1(d,z);
ob2[i]=sum(ob,ob1);
}
for(int i=0;i<n;i++)
{
t=ob2[i];
ob2[i].display(t);
}
}
return 0;
}
No comments:
Post a Comment