Skip to content
TFE Times

TFE Times

Business, Technology, and Culture

MAFI_728x90
Brandeis University Master of Finance Leaderboard 728x90
University of California Irvine Leaderboard
MAFI_728x90
Click here
Click here
RPI Leaderboard
Click here
NYU Tandon School of Engineering Leaderboard
University of California Irvine Leaderboard
  • Business
  • Culture
  • Technology
  • International Rankings
    • Bangladesh
    • Canada
    • Egypt
    • India
    • Nigeria
    • Pakistan
    • Philippines
    • United Kingdom
    • United States of America
  • Masters Rankings
    • Accounting
    • Business Analytics
    • Chiropractic
    • Computer Engineering
    • Computer Science
    • Economics
    • Education
    • Finance
    • Financial Economics
    • Financial Engineering
    • Law
    • Management
    • Marketing
    • MBA
    • Nursing
    • Social Work
  • Resources
    • C++
      • Beginner’s Guide to C++
      • An Introduction to the Imperative Part of C++
      • C++ Code
        • Sorts
        • Binary Search Trees
        • Strings
        • Binary Search
        • Math
        • Quant
        • Puzzles/Games
        • Language Concepts
        • Graphics
        • OS Operations
        • Graphs
      • C++ Full Course
      • C++ Crash Course
      • C++ Interview Questions
      • C++ Q/A
      • C++ Books
      • C++ Free Books
      • C++ Videos
    • C Questions
    • C Programming Tips
    • Java Questions
    • Quant Data Sources
    • Quant Questions

C++: Loop Continue

Posted on September 1, 2017April 1, 2018 by TFE Times
Posted in C++Tagged c, continue, loop, loops
Bjarne-stroustrup
 


Show the following output using one loop.

1, 2, 3, 4, 5
6, 7, 8, 9, 10

Try to achieve the result by forcing the next iteration within the loop upon a specific condition, if your language allows it.

for(int i = 1;i <= 10; i++){
   cout << i;
   if(i % 5 == 0){
      cout << endl;
      continue;
   }
   cout << ", ";
}

SOURCE

Content is available under GNU Free Documentation License 1.2.

Related

Post navigation

Bjarne-stroustrup
← Previous

C++: For Loop

September 1, 2017
Bjarne-stroustrup
Next →

C++: Black Scholes Put Option Rho

September 1, 2017

Related Posts

Bjarne-stroustrup

C++: Animate a Pendulum

Posted on September 1, 2017April 1, 2018
Bjarne-stroustrup

C++: Display Color Pinstripe

Posted on September 1, 2017April 1, 2018
Bjarne-stroustrup

C++: Brownian Tree

Posted on September 1, 2017April 1, 2018
output_8BgzjE
University of California Berkeley Master of Financial Engineering MFE Sideboard
Brandeis Business School
NYU Tandon School of Engineering Sideboard
University of California Irvine Leaderboard
Click here
  • What The World’s Paying For Eggs

    September 19, 2025May 25, 2025 by TFE Times
  • How Do Car Accident Laws Work in Queens Under New York’s No-Fault System?

    September 17, 2025 by TFE Times
  • All About Playing at Golden Crown Casino: A Guide for Australian Players

    September 17, 2025 by TFE Times
  • Table Games at Legiano Casino: Roulette, Poker and Blackjack

    September 17, 2025 by TFE Times
  • Supporting Curiosity and Critical Thinking in Young Learners

    September 17, 2025 by TFE Times
  • Post-Pandemic GDP Recovery

    September 17, 2025May 25, 2025 by TFE Times
  • Imports’ Share Of Economies

    September 16, 2025May 25, 2025 by TFE Times
  • Why Millennials and Gen Z Are Choosing Slots Over Traditional Table Games

    September 15, 2025 by TFE Times
  • How to Open a Checking Account and Start Building Financial Independence

    September 15, 2025 by TFE Times
  • The Cost Of Cash: Interest Rates In 2025

    September 15, 2025September 17, 2025 by TFE Times

Copyright © TFE Times, LLC. All Rights Reserved.

Terms of Service | Privacy Policy | Disclaimer

WordPress Theme : Eight Paper by 8Degree Themes