发布网友 发布时间:2022-04-22 08:20
共1个回答
热心网友 时间:2022-06-18 12:42
摘要待处理的数据如下:(小写字母行的字母是自行加上的,GOTO后的数据分别要赋值到x y z i j k u v w中,各数据间使用逗号分开的,$$后面的三个数据是u v w)小写字母: x y z i j k u v wGOTO/23.4932,-81.4323,107.7596,-0.6389673,-0.4383417,0.6321213 $$ 23.4397,-81.6183,107.5881GOTO/23.4202,-81.2891,107.7604,-0.6391031,-0.4390556,0.6314882 $$ 23.3878,-81.4743,107.6062GOTO/23.3478,-81.1456,107.7612,-0.6392378,-0.4397696,0.6308548 $$ 23.3212,-81.3314,107.6113GOTO/23.2754,-81.0020,107.7620,-0.6393714,-0.4404837,0.6302209 $$ 23.2486,-81.1889,107.6112GOTO/23.2030,-80.8585,107.7628,-0.6395038,-0.4411979,0.6295866 $$ 23.1760,-81.0464,107.6110逐行读取文件的程序如下:include //ifstreamincludeinclude //包含getline()includeusing namespace std;int main(){string s;ifstream inf;inf.open(“F://九坐标生成.txt”); //打开F为文件所在位置,//打开输出文件ofstream outf;outf.open(“F://out.txt”);while (getline(inf, s)) //getline(inf,s)是逐行读取inf中的文件信息{outf << s << ‘\n’;cout << s << endl << endl;}inf.close();outf.close();return 0;}然后读取文件后把得到的x y z i j k u v w进行如下计算:include include include def咨询记录 · 回答于2021-12-01求解,C语言中读取数字并且赋值给变量的问题待处理的数据如下:(小写字母行的字母是自行加上的,GOTO后的数据分别要赋值到x y z i j k u v w中,各数据间使用逗号分开的,$$后面的三个数据是u v w)小写字母: x y z i j k u v wGOTO/23.4932,-81.4323,107.7596,-0.6389673,-0.4383417,0.6321213 $$ 23.4397,-81.6183,107.5881GOTO/23.4202,-81.2891,107.7604,-0.6391031,-0.4390556,0.6314882 $$ 23.3878,-81.4743,107.6062GOTO/23.3478,-81.1456,107.7612,-0.6392378,-0.4397696,0.6308548 $$ 23.3212,-81.3314,107.6113GOTO/23.2754,-81.0020,107.7620,-0.6393714,-0.4404837,0.6302209 $$ 23.2486,-81.1889,107.6112GOTO/23.2030,-80.8585,107.7628,-0.6395038,-0.4411979,0.6295866 $$ 23.1760,-81.0464,107.6110逐行读取文件的程序如下:include //ifstreamincludeinclude //包含getline()includeusing namespace std;int main(){string s;ifstream inf;inf.open(“F://九坐标生成.txt”); //打开F为文件所在位置,//打开输出文件ofstream outf;outf.open(“F://out.txt”);while (getline(inf, s)) //getline(inf,s)是逐行读取inf中的文件信息{outf << s << ‘\n’;cout << s << endl << endl;}inf.close();outf.close();return 0;}然后读取文件后把得到的x y z i j k u v w进行如下计算:include include include def路径须是绝对路径,value数组是保存x y z i j k u v w的值的数组输出结果:23.4932 -81.4323 107.76 -0.638967 -0.438342 0.632121 0 23.4397 -81.6183 107.588这是原题老师我们给你参考的答案意见,剩下的你要自己去做,我们不能给你写代码。如果你有这方面的需求,可以在猪八戒网上去求写代码。但是那个费用就比较高了。