【发布时间】:2023-03-14 14:48:02
【问题描述】:
在
4
5
6
7
#include<iostream>
#include<stdio.h>
#include <fstream>
using namespace std;
int main()
{
int data[4], a, b, c, d, e, f;
ifstream myfile;
myfile.open("tera.txt");
for (int i = 0; i < 4; i++)
{
myfile >> data[i];
}
myfile.close();
a = data[0];
b = data[1];
c = data[2];
d = data[3];
cout << a << "\t" << b << "\t" << c << "\t" << d << "\n";
return 0;
}
它也需要 AT 并给出垃圾值。我应该如何以及在哪里使用忽略功能来忽略 AT 值。 如果给定 BT 的另一个数组包含这样的一些值,那么还有一件事: 英国电信 如何将BT下的所有值存储在一个数组中?
【问题讨论】:
-
“我已经尽力了”请edit你的问题展示你最好的一面。
-
@DrewDormann 完成!
-
@CaptainObvlious 完成!
-
请先研究一下。已经回答了太多关于从文件中读取的问题:"StackOverflow c++ read from file"。您可能希望通过附加“into struct”或“columns”来缩小搜索范围。
-
@ThomasMatthews 你告诉我如何忽略上述代码的 AT?
标签: c++ file file-handling filehandle