이것은 내 코드입니다. 파일을 만들지 만 입력 한 첫 번째 단어 만 인쇄합니다. 도와주세요.offtstream은 파일을 만들고 있지만 시작 문자열은 전체 문자열이 아닙니다.
std::string userinput;
int a =rand() % 4+1;
std::stringstream ss;
ss << a;
std::string line = ss.str();
std::string mfile="C:\\Users\\Venom\\Documents\\atom\\c++\\projects \\pyramid\\info files\\infernotxt\\help\\greeting\\" +line;
//std::cout << mfile << '\n';
std::ifstream infile(mfile.c_str());
getline(infile, line);
std::cout << infernoname<<line << '\n';
infile.close();
std::cout << username;
std::ofstream output(guestfolder.c_str());
std::getline(std::cin, userinput);
output<<userinput;
output.close();
경우'infernoname'이/초기화 선언은? – drescherjm
제 조언은 Visual Studio와 같은 디버거와 함께 IDE를 사용하는 것입니다. 따라서 코드를 한 단계 씩 실행하여 각 단계의 변수를 살펴볼 수 있습니다. 그렇게하면 프로그램이 예상 한대로 작동하지 않는 부분을 빠르게 찾을 수 있습니다. – drescherjm