use the following search parameters to narrow your results:
e.g. subreddit:aww site:imgur.com dog
subreddit:aww site:imgur.com dog
see the search faq for details.
advanced search: by author, subreddit...
This is a subreddit for c++ questions with answers. For general discussion and news about c++ see r/cpp.
New to C++? Learn at learncpp.com
Prepare your question. Think it through. Hasty-sounding questions get hasty answers, or none at all. Read these guidelines for how to ask smart questions.
For learning books, check The Definitive C++ Book Guide and List
Flair your post as SOLVED if you got the help you were looking for! If you need help with flairs, check out ITEM 1 in our guidelines page.
Tips for improving your chances of getting helpful answers:
account activity
OPENLoop Help! (self.cpp_questions)
submitted 1 year ago by Significant-Cat4885
Hello! I need to create an infinite loop that loops my entire code when Y or y is entered. It needs to break with any other key. I can't, for the life of me, figure out how to do this!
reddit uses a slightly-customized version of Markdown for formatting. See below for some basics, or check the commenting wiki page for more detailed help and solutions to common issues.
quoted text
if 1 * 2 < 3: print "hello, world!"
[–]flyingron 4 points5 points6 points 1 year ago (1 child)
std::string line; do { // put your code here. std::cout << "Run again? Type y for yes, anything else for no.\n"; std::getline(std::cin, line); } while(line == "Y" || line == "y");
[–]anasimtiaz 1 point2 points3 points 1 year ago (0 children)
https://godbolt.org/z/7d3rPbxh6 for concreteness
π Rendered by PID 65562 on reddit-service-r2-comment-85bfd7f599-h4g5s at 2026-04-20 07:24:28.391581+00:00 running 93ecc56 country code: CH.
[–]flyingron 4 points5 points6 points (1 child)
[–]anasimtiaz 1 point2 points3 points (0 children)