1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73
|
cout <<"Enter the filename " << endl;
getline (cin, filename2);
ifstream inFile2;
inFile2.open(filename2.c_str());
if (!inFile2){
cout<<"Error opening - " <<filename2<<endl;
system("PAUSE");
return -1;
}
cout << "Please key in dimension, remove_node_time and dead age and press enter:" <<endl;
cin >> DIMENSION;
cin >> REMOVE_NODE_TIME;
cin >> DEADE_AGE;
cout <<"Please specify how many columns need to skip: " <<endl;
cin >> columns_skip;
cout <<"Please enter number of columns to be read: " <<endl;
cin >> columns_read;
pSOINN = new CSOINN( DIMENSION, REMOVE_NODE_TIME, DEADE_AGE);
while (getline(inFile2, line2))
{
string dataEntry; //a particular entry as string
istringstream lineStream(line2);
for(b=0; b < columns_skip; b++){
getline( lineStream, dataEntry, ',');//skip number of columns
}
for( a=0; a < columns_read; a++){
getline( lineStream, dataEntry, ',');
lineStream >> ws; //remove whitespace after the comma and before the next entry
istringstream(dataEntry) >> item2[a];
}
}
cout <<"Enter the second filename " << endl;
getline (cin, filename);
ifstream inFile;
inFile.open(filename.c_str());
if (!inFile){
cout<<"Error opening - " <<filename<<endl;
system("PAUSE");
return -1;
}
cout << "Please key in dimension, remove_node_time and dead age and press enter:" <<endl;
cin >> DIMENSION;
cin >> REMOVE_NODE_TIME;
cin >> DEADE_AGE;
cout <<"Please specify how many columns need to skip: " <<endl;
cin >> columns_skip;
cout <<"Please enter number of columns to be read: " <<endl;
cin >> columns_read;
while (getline(inFile, line))
{
string dataEntry; //a particular entry as string
istringstream lineStream(line);
for(b=0; b < columns_skip; b++){
getline( lineStream, dataEntry, ',');//skip number of columns
}
for( a=0; a < columns_read; a++){
getline( lineStream, dataEntry, ',');
lineStream >> ws; //remove whitespace after the comma and before the next entry
istringstream(dataEntry) >> item[a];
}
pSOINN->InputSignal(item, columns_read);
}
|