even integers

I'm trying to print all positive even integers less than or equal to a max value. in my case it's 10. This is my starting point and i'm lost
/////
#include <iostream>
#include <math.h>
using namespace std;

int main(printEvenNums){
int userChoice = 0;
while (userChoice != 0)
int i = 0;
while (i < 10)
{
cout<< i << endl;
i = i + 2;
}
}
I don't see any reason for userChoice to exist. Take it out.


int main(printEvenNums)
This makes no sense at all. The function signature of main is:
int main()
Last edited on
Thank you so much. I got my code to print out even numbers all the way to 10. Pretty much by taking out those variables.
///

#include <iostream>
#include <math.h>
using namespace std;

int main()
{
int printEvenNums;
int i = 0;
while (i < 12)
{
cout<< i << endl;
i = i + 2;
}
}
Topic archived. No new replies allowed.