y‰SŽÒнŒ}zC/C++Ž ..
[2ch|¥Menu]
217:ƒfƒtƒHƒ‹ƒg‚Ì–¼–³‚µ‚³‚ñ
08/03/03 02:31:37
>>215
‰üs‚͓ǂݞ‚܂Ȃ¢‚©‚çgetline‚ª‚¢‚¢B

std::string filename = "default_file.txt";
while (1) {
std::string tmp;
std::cout << "Input file name : (hit return to default: " << filename << ") ";
std::getline(std::cin, tmp);
if (tmp.empty()) {
tmp = filename;
}
std::cout << "filename : " << tmp << " OK (Y|N) ? ";
std::string ans;
std::getline(std::cin, ans);
if (ans == "Y") {
filename = tmp;
break;
}
}


ŽŸƒy[ƒW
ÅVƒŒƒX•\ަ
ƒXƒŒƒbƒh‚ÌŒŸõ
—ÞŽ—ƒXƒŒˆê——
˜b‘è‚̃jƒ…[ƒX
‚¨‚Ü‚©‚¹ƒŠƒXƒg
¥ƒIƒvƒVƒ‡ƒ“‚ð•\ަ
‰É‚‚Ԃµ2ch

5159“ú‘O‚ÉXV/245 KB
’S“–:undef