#include <fstream>
#include <iostream>
#include <sstream>
#include <string>
#include <vector>
using namespace std;
typedef vector <double> record_t;
typedef vector <record_t> data_t;
int sorted(int *data,int max_record_size)
{
}
int main()
{
// Here is the data we want.
data_t data;
// Here is the file containing the data. Read it into data.
ifstream infile( "sort.txt" );
infile >> data;
// Complain if something went wrong.
if (!infile.eof())
{
cout << "Fooey!\n";
return 1;
}
infile.close();
// Otherwise, list some basic information about the file.
cout << "Your CSV file contains " << data.size() << " records.\n";
unsigned max_record_size = 0;
for (unsigned n = 0; n < data.size(); n++)
if (max_record_size < data[ n ].size())
max_record_size = data[ n ].size();
cout << "The largest record has " << max_record_size << " fields.\n";
int i;
for (i=0; i <= max_record_size; i++)
{
cout << "your data contains " << data[ 0 ][ i ] << ".\n";
int temp[max_record_size];
sorted(&data,max_record_size);
//cout << "Your sorted data contains" << sorted [0] [i] << ".\n";
}
cout << "Good bye!\n";
system("PAUSE");
return 0;
}
无法将
data_t*' to
int*' 转换为参数1' to
int sorted(int*, int)'
我试图将我的数据指针传递给我的排序函数,它应该是一个包含我的数字列表的数组,我到底做错了什么,请你详细解释一下,以便我理解,谢谢!