1
#include <iostream>
#include <fstream>
using namespace std;
int main()
{
ifstream inFile;
inFile.open("test.txt");
int foo;
string sFoo;
inFile >> sFoo;
inFile >> foo;
cout << "the name is " << sFoo << endl;
cout << "the first number is " << foo << endl;
inFile >> foo;
cout << "the second number is " << foo << endl;
cout << "Hello World!";
return 0;
}
私はテキストファイルを同じフォルダに配置しようとしました。ただし、何らかの理由でテキストファイルを読み取ることができません。これを実現させるために、誰かがMacBookのコードブロックで何をすべきか教えてください!MacでコードブロックをIfstreamするには?