From c4b1a6807641d01a7a3ea3261ff6b178b71a7e77 Mon Sep 17 00:00:00 2001 From: Asahel Date: Thu, 1 Feb 2024 09:26:05 -0800 Subject: Finished --- InClassExercise8/NestedLoops.cpp | 44 ++++++++++++++++++++++++++++++++++++++++ 1 file changed, 44 insertions(+) (limited to 'InClassExercise8/NestedLoops.cpp') diff --git a/InClassExercise8/NestedLoops.cpp b/InClassExercise8/NestedLoops.cpp index e69de29..24407f8 100644 --- a/InClassExercise8/NestedLoops.cpp +++ b/InClassExercise8/NestedLoops.cpp @@ -0,0 +1,44 @@ +// Name: Asahel +// Date: 1/31/24 +// Class: CST 116 +// Assignment: InClassExercise8 + +#include +#include "NestedLoops.h" + +using std::cout; +using std::cin; +using std::endl; + +void NestedForLoopExamples(); +void NestedWhileLoopExamples(); +void NestedDoWhileLoopExamples(); + +int main() { + + NestedForLoopExamples(); + { + + for (int i = 0, j = 5; i < 5; ++i, --j) + cout << i << " " << j << "\n"; + + } + NestedWhileLoop(5, 10); { + int j = 10; + int i = 0; + while (i < 5 && j > 5) { + cout << i << "," << j << " "; + i++; + j--; } + + NestedDoWhileLoop(5, 10); { + + int j = 10; + i = 0; + do { + cout << i << "," << j << " "; + i++; + j--; + } while (i < 5 && j > 5); + + return 0; } \ No newline at end of file -- cgit v1.2.3