请教c++中,如何读取一个txt文本文件中的数

2025-04-26 10:48:50
推荐回答(1个)
回答1:

以ifstream打开。 然后就和从屏幕输入一样了。
比如
ifstream fs("in.txt");
int n;
fs>>n;