我将乘以用户必须输入的两个多项式。
在第一步(从用户那里获取信息)我得到了这个错误:
Unhandled exception at 0x00a315cb in linked polinomials.exe:
0xC0000005: Access violation writing location 0x00000000.
之后我想输入多项式的另一个元素后出现此错误。
struct polynomial{
float coef ;
int exp ;
polynomial *next ;
} *first, *second ,*result;
first = new(polynomial);
//init first
first ->coef = 0;
first->exp = 0 ;
first->next = 0;
while(ch != 'n')
{
cin >> temp_c ;
cin >> temp_e ;
first->coef = temp_c;
first->exp = temp_e;
cout << "Do you want to enter another ? (y or n) :" << endl;
ch = getch();
first = first->next;
}