有关C++输入一元多次方程式的问题

来源:百度知道 编辑:UC知道 时间:2024/05/28 18:07:26
这个程序肯定是那个cout 和 cin 中出错了,我就想着让他一起输入系数和指数,请帮我在原程序上改一下,谢谢,急用。。。
#include <iostream>
using namespace std;

const int MAXSIZE=100;
class SeqList
{
public:
double coef[MAXSIZE];
int exp[MAXSIZE];
int length;
SeqList() {length=0;}
void ClearList() {length=0;}
bool IsListEmpty() {return length == 0;}
bool IsListFull() {return length == MAXSIZE;}
void ListInsert( int i,double coef,int exp );
void Display();
};

void SeqList::ListInsert( int i, double c, int e )
{
if ( i<1 || i>length+1 || length == MAXSIZE )
cout << "插入位置错误或满表";
else {
for ( int j=length -1;j >=i-1;j-- ) {
coef[j+1] = coef[j];
exp[j+1] = exp[j];
}
coef[i-1] = c;
exp[i-1] = e;
length++;
}
}

void SeqList::Display()
{
cout<< " ";
for( int i=0; i<length; i++ )

#include <iostream>
using namespace std;

const int MAXSIZE=100;
class SeqList
{
public:
double coef[MAXSIZE];
int exp[MAXSIZE];
int length;
SeqList() {length=0;}
void ClearList() {length=0;}
bool IsListEmpty() {return length == 0;}
bool IsListFull() {return length == MAXSIZE;}
void ListInsert( int i,double coef,int exp );
void Display();
};

void SeqList::ListInsert( int i, double c, int e )
{
if ( i<1 || i>length+1 || length == MAXSIZE )
cout << "插入位置错误或满表";
else {
for ( int j=length -1;j >=i-1;j-- ) {
coef[j+1] = coef[j];
exp[j+1] = exp[j];
}
coef[i-1] = c;
exp[i-1] = e;
length++;
}
}

void SeqList::Display()
{
cout<< " ";
for( int i=0; i<length; i++ )
{
cout << coef[i];
if(exp[i]>0) cout<&