Answer the question
In order to leave comments, you need to log in
Why doesn't it display the degree of the polynomial?
What could be wrong?
#include<iostream>
#include<conio.h>
using namespace std;
class Polinom {
private:
unsigned int degree;
double *exponents;
public:
Polinom();
~Polinom();
friend istream& operator >>(istream&, Polinom&);
friend ostream& operator <<(ostream&, Polinom&);
};
int main() {
Polinom p;
cout << p;
getch();
return 0;
}
Polinom::Polinom() {
degree = 0;
exponents = new double[1];
exponents[0] = 0.0;
}
ostream& operator <<(ostream& os, Polinom& p) {
os << 'degree: ' << p.degree;
return os;
}
Polinom::~Polinom() {
}
Answer the question
In order to leave comments, you need to log in
Strings must be enclosed in double quotes.os << "degree: " << p.degree;
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question