1.

What is the output of this program?
#include <iostream>
using namespace std;
class vectorClass
{
public:
vectorClass(float float1, float float2)
{
p = float1;
q = float2;
}
vectorClass()
{
}
float p;
float q;
};
vectorClass addvectors(vectorClass vect1, vectorClass vect2);
int main()
{
vectorClass vect1(4, 7);
vectorClass vect2(5, -3);
vectorClass vect3 = addvectors(vect1, vect2);
cout << vect3.p << ", " << vect3.p << endl;
}
vectorClass addvectors(vectorClass vect1, vectorClass vect2)
{
vectorClass result;
result.p = vect1.p + vect2.p;
result.q = vect1.q + vect2.q;
return result;
};

A. 9
B. Compilation Error
C. 9, 9
D. Runtime Error
E. None of these
Answer» D. Runtime Error


Discussion

No Comment Found

Related MCQs