Loop structures: Difference between revisions
Content added Content deleted
(Added C++) |
(Added C++) |
||
Line 52: | Line 52: | ||
// If it remains nonzero, we'll have an infinite loop. |
// If it remains nonzero, we'll have an infinite loop. |
||
} while ( condition ); |
} while ( condition ); |
||
} |
|||
[[Category:C plus plus]] |
|||
=== Run-Time Control Structures === |
|||
====while==== |
|||
'''Compiler:''' [[GCC]] 4.1.2 |
|||
int main (void) { |
|||
int condition = 1; |
|||
while ( condition ) { |
|||
// Do something |
|||
// Don't forget to change the value of condition. |
|||
// If it remains nonzero, we'll have an infinite loop. |
|||
} |
|||
} |
|||
====do-while==== |
|||
'''Compiler:''' [[GCC]] 4.1.2 |
|||
int main (void) { |
|||
int condition = 1; |
|||
do { |
|||
// Do something |
|||
// Don't forget to change the value of condition. |
|||
// If it remains nonzero, we'll have an infinite loop. |
|||
} while ( condition ); |
|||
} |
} |