#include #include #include using namespace std;

void PRENODE(fstream& IPP, int* IND, int& ITP, int L0, int NCHE) { double XYZ[3]; string AAA; ITP = 0; int IADD = 0; IPP.seekg(0, ios::beg);

while (getline(IPP, AAA)) {
    if (AAA.substr(0, 8) == "SHETNODE") {
        int L0D;
        sscanf(AAA.substr(9).c_str(), "%d %lf %lf %lf", &L0D, &XYZ[0], &XYZ[1], &XYZ[2]);
        IADD++;
        IND[IADD] = L0D;
        if (L0D == 0) {
            ITP = 1;
        }
    }
}

cout << endl;
if (NCHE == 2) {
    cout << "******* Error in the following data *******" << endl;
}
cout << AAA << endl;
cout << endl;

ofstream output("output.txt");
output << endl;
if (NCHE == 2) {
    output << "******* Error in the following data *******" << endl;
}
output << AAA << endl;
output << endl;

IPP.close();
output.close();

}

int main() { fstream IPP("input.txt", ios::in); int IND[100]; int ITP = 0; int L0 = 100; int NCHE = 2;

PRENODE(IPP, IND, ITP, L0, NCHE);

return 0;

}

C++实现FORTRAN子程序PRENODE:解析SHETNODE数据

原文地址: http://www.cveoy.top/t/topic/pCXC 著作权归作者所有。请勿转载和采集!

免费AI点我,无需注册和登录