c++程序编译通过却无法运行

来源:百度知道 编辑:UC知道 时间:2024/05/25 21:06:32
#include <iostream>//计算多项式的+、-、*
using namespace std;
int main()
{
int an,bn,cn=0,n,nn;
int a[10],b[10],c[100],d[10];
void add(int a[],int b[],int array[],int an,int bn,int cn);
void subtract(int a[],int b[],int array[],int d[],int an,int bn,int cn);
void multiply(int a[],int b[],int array[],int an,int bn,int cn);
cout<<"Please input p1!"<<endl;
cin>>an;
for(int i=0;i<an;i++)
cin>>a[i];
cout<<"Please input p2!"<<endl;
cin>>bn;
for (int j=0;j<=bn;j++)
cin>>b[j];
cout<<"What do you want to do?"<<endl;
cout<<"1.add"<<endl<<"2.subtact"<<endl<<"3.multiply"<<endl<<"Please input the number and press the enter button"<<endl;
cin>>n;
switch(n)
{
case 1:add(a,b,c,a

1>生成日志保存在“file://f:\practice\p4\Debug\BuildLog.htm”
1>p4 - 2 个错误,0 个警告
========== 生成: 成功 0 个,失败 1 个,最新 0 个,跳过 0 个 ==========

把main函数后边的几个函数都移到main函数之前去。

数组越界,