【发布时间】:2015-04-30 21:46:59
【问题描述】:
我刚刚安装了Eclipse C++,想在上面测试一些程序,我复制粘贴了一个随机代码,命名为main.cpp,运行它,出现14个错误
代码:
#include<iostream>
#include<cmath>
using namespace std;
int main() {
int i,j,m,n,l;
float x[10],a[10][10],b[10],c[10];
cout<<"\nEnter the value of n : \n";
cin>>n;
cout<<"\nEnter the number of iterations : \n";
cin>>l;
cout<<"\nEnter the right hand side constants : \n";
for(i=0;i<n;i++) {
cin>>b[i];
}
cout<<"\nEnter the coefficients row wise : \n";
for(i=0;i<n;i++) {
x[i]=0;
for(j=0;j<n;j++) {
cin>>a[i][j];
}
}
m=1;
line:
for(i=0;i<n;i++) {
c[i]=b[i];
for(j=0;j<n;j++) {
if(i!=j) {
c[i]=c[i]-a[i][j]*x[j];
}
}
}
for(i=0;i<n;i++) {
x[i]=c[i]/a[i][i];
}
m++;
if(m<=l) {
goto line;
}
else {
cout<<"\nThe Solution is : \n";
for(i=0;i<n;i++) {
cout<<"\nx("<<i<<") = "<<x[i]<<"\n";
}
}
}
错误: 在 PATH 中找不到程序“g++” 在 PATH 中找不到程序“gcc” 在 PATH 中找不到程序“make” 符号“cin”无法解析 符号“std”无法解析
【问题讨论】:
-
Eclipse 不包含 C++ 编译器和其他必要的工具。根据您的操作系统,您需要安装适当的工具。