A Comparative Analysis of Looping Structures: Comparison of ‘While’ Loop and ‘Do-While’ Loop in the C++ Language

Main Article Content

P. Shouthiri
N. Thushika

Abstract

Looping is one of the fundamental logical instructions used for repeating a block of statements. All programming languages are used looping structures to simplify the programs. Loops are supported by all modern programming languages, though their implementations and syntax may differ. This paper compares the two types of looping structures while and do-while using the compile time and runtime of the given programs to improve the efficiency of the programs. It is found that for small number of iterations while is efficient in runtime and do-while is efficient in compile time, the difference in total execution time may not be considerable. But given any large number of iterations, the difference is noticeable.

Keywords:
Loop, while loop, do-while loop, compile time, run time.

Article Details

How to Cite
Shouthiri, P., & Thushika, N. (2019). A Comparative Analysis of Looping Structures: Comparison of ‘While’ Loop and ‘Do-While’ Loop in the C++ Language. Asian Journal of Research in Computer Science, 2(3), 1-5. https://doi.org/10.9734/ajrcos/2018/v2i328752
Section
Original Research Article