Replacing single variables with a 2 dimensional array

Hi, I have a problem, I just wrote a program for a polynomial that holds both a coefficient and an exponent using two separate variables, but I just decided that I would rather use a two dimensional array to hold the two respective numbers instead. Unfortunately I'm failing utterly switching out an array for the former. Can someone help? (Also I'm not entirely sure I need a 2 dimensional array in this situation, so if I'm just over thinking that aspect of it, and a 1 dimensional array would work fine please let me know). Here's the program as is:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50

#include <iostream>
using namespace std;

class Polynomial
{
private:
    int coefficient;
    int exponent;
public:
    Polynomial(int,int);
    int set();
    void get();
};

Polynomial::Polynomial(int c, int e)
{
    coefficient = c;
    exponent = e;
}

int Polynomial::set()
{
    cout << "Input the polynomial integer coefficient: ";
    cin >> coefficient;
    cout << "Input the polynomial integer exponenet: ";
    cin>> exponent;
    
    return coefficient;
    return exponent;
}

void Polynomial::get()
{
    cout << coefficient << "x^" << exponent <<endl;
    
}

int main()
{
    int coefficient = 0;
    int exponent = 0;
    
    Polynomial Polynomial(coefficient, exponent);
    Polynomial.set();
    cout << "The polynomial expression is: ";
    Polynomial.get();
  
}



Thanks!
Topic archived. No new replies allowed.