我正在嘗試編寫一個程序,該程序將對三對角矩陣執行一些研究生級數值分析。C++矢量完整的矢量問題
我很確定我有數據輸入,我無法弄清楚爲什麼代碼 vector <vector <double>> x;
正在踢回聖經比例的錯誤。
的代碼如下:
#include <iostream>
#include <vector>
#include <cstdlib>
#include <iterator>
#include <iomanip>
using namespace std;
int main()
{
int i, j;
double y;
vector< vector<double> > x(10);
//Stuff data packets
for (i = 0; i < 9; i++)
{
cin >> y;
x.push_back(y);
}
//display
for (j = 0; j < 9; j++)
{
cout << x[j] << setw(5);
}
cout << endl;
cout << x.size(); //Making sure it's right size
return 0;
}
如何使一個完整的C++載體的載體!?
等待,你的意思是說矢量<矢量< double>> X(10)線;是不工作的?如果是這樣,它會顯示什麼錯誤? – spektr
錯誤在哪裏發生?什麼是錯誤(確切消息)? – user463035818
如果您遇到錯誤並希望獲得幫助,您應該在錯誤中包含錯誤。 – NathanOliver