I think I have an issue but I'm not sure

Would someone mind double checking my code? There are newlines after each line displayed that I didn't code for and a lot of dead space at the end. I get the general output that I need (All even numbers between 1 and 100) but I'm concerned that these newlines and the dead space is a sign of a mistake that I've made. When I use the C++ Shell online I don't get all the dead space but the unexpected newlines are still there. Is this to be expected when one uses do...while? I'm new to C++ and I have very, very little prior experience in programming of any sort. Thanks for any help that anyone can provide.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
//Print out of all even numbers between 1 and 100 using while loop.

#include "stdafx.h" // Required for Visual Studio
#include <iostream>
using namespace std;


int main() {
	int number = 1;
	int pause; // Visual Studio work around that I found

	do {
		cout << endl;
		number++;
		do {
			cout << "Number: " << number << endl;
			number ++;
		} while (number % 2 == 0);
	}

	while (number <= 100);
	
	cin >> pause; // Visual Studio work around that I found 
	return 0;
}
line 13: Every time you iterate through your loop, you create a new line before printing out the number.
Line 10: You don't need this if you want to pause the console.
line 23: Change to system("pause");
You are inserting newlines at 2 points in your program: line 13 and again the endl on line 16
line 13 is putting a newline in that you may not want.
Topic archived. No new replies allowed.