转化成C++语言 SUBROUTINE PRENODEIPPINDITPL0NCHE IMPLICIT REAL8A-HO-Z DIMENSION INDL0 DIMENSION XYZ3 CHARACTER AAA200 ITP=0 IADD=0 REWINDIPP 100 READIPP103E
#include
void PRENODE(std::ifstream& IPP, int* IND, int& ITP, int L0, int NCHE) { double XYZ[3]; std::string AAA; int IADD = 0; ITP = 0; int L0D;
IPP.seekg(0, std::ios::beg);
while (std::getline(IPP, AAA)) {
if (AAA.substr(0, 8) == "SHETNODE") {
std::istringstream iss(AAA.substr(10, 200));
if (!(iss >> L0D >> XYZ[0] >> XYZ[1] >> XYZ[2])) {
std::cout << "Error in the following data:" << std::endl;
std::cout << AAA << std::endl;
std::cout << std::endl;
std::cerr << "Error in the following data:" << std::endl;
std::cerr << AAA << std::endl;
std::cerr << std::endl;
exit(1);
}
IADD++;
IND[IADD] = L0D;
if (L0D == 0) {
ITP = 1;
}
}
}
}
int main() { std::ifstream IPP("input.txt"); int IND[10]; int ITP; int L0 = 10; int NCHE = 2; PRENODE(IPP, IND, ITP, L0, NCHE); return 0;
原文地址: http://www.cveoy.top/t/topic/h3KN 著作权归作者所有。请勿转载和采集!