W
W
Wasya UK2017-09-23 20:27:15
C++ / C#
Wasya UK, 2017-09-23 20:27:15

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

2 answer(s)
M
Maxim Moseychuk, 2017-09-23
@dmc1989

Strings must be enclosed in double quotes.
os << "degree: " << p.degree;

A
Alexey Gordienko, 2017-09-23
@RdSpclL

Clear your memory please

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question