Skip to content
Research Article Open access CC BY 4.0

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

P. Shouthiri, N. Thushika

Asian Journal of Research in Computer Science · pp. 1–5 · Published 17 Jan 2019

10.9734/ajrcos/2018/v2i328752

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.

Loop while loop do-while loop compile time run time.

Cited by 1

The Effect of Using Web-Based Interactive Learning Media for Vocational High School Students to Understanding of Looping: Qualitative Approach

Dwi Fitria Al Husaeni, Enrico Nabil Qois Budisantoso, Mushfani Ainul Urwah · Journal of Science Learning · 2022

Article metrics

Real usage data collected on this platform.

0

Page views

0

PDF downloads

0

Outbound clicks

1

Citations

Views by country

Approximate, from request IP at view time — not citizenship or institution. Countries with fewer than 5 views are grouped as "Other".

No views recorded yet.

Traffic sources

Referring site, by host.

No traffic recorded yet.

Views and downloads exclude known bots/crawlers. Citations combines this platform's own DOI-resolved index with each external source's own reported total — see Cited by above for individually listed citing works. Last refreshed 0 seconds ago.