Hey guys, I'm learning to code myself from an old C++ text book. I came across this in the book where it asks to solve it. I have literally tried to code this but have had no success in the past 10 hours or so spent on this. C++ is my first programming language so don't be too hard on me. The commented part is what its asking for. Two different ways to write loops for Loops A,B,C. any help would be MUCH appreciated.
#include <iostream>
using namespace std;
int main(int argc, char* argv[]) {
cout << "Loop A (for version)" << endl;
for (int i=0;i<5;i++) {
cout << i << endl;
}
cout << "Loop A (while version)" << endl;
// Add while loop code
cout << "Loop A (do while version)" << endl;
// Add do while loop code
cout << "Loop B (do while version)" << endl;
int i;
do {
cout << "Enter a number less than 100 (Greater than 100 to exit):" << endl;
cin >> i;
cout << i << endl;
} while (i<100);
cout << "Loop B (for version)" << endl;
// Add for loop code
cout << "Loop B (while version)" << endl;
// Add while loop code
cout << "Loop C (while version)" << endl;
int i = 20;
while (i>10) {
cout << i*2 << " ";
i-=2;
}
cout << endl << endl;
cout << "Loop C (do while version)" << endl;
// Add do while loop code
cout << "Loop C (for version)" << endl;
// Add for loop code