Hello my first post brings with it my first c++ problem. Having no previous coding experience, I went out and bought C++ Without Fear as recommended by the site and ran into difficulties with the first if/else lesson. It's also the first lesson using the % as a division mechanic. Im using Visual Studio C++ express edition for this.
Ive looked at the example 5-6 times now and am quite sure that I've copied it verbatim, but this is the first time that I've entered something without it working at all. Any ideas as to what Im doing wrong?Code:#include <stdafx.h> #include <iostream> using namespace std; int main() { int n, remainder; cout << "Enter a number and press ENTER: "; cin >> n; remainder = n % 2; if (remainder == 0) cout << "The number is even."; else cout << "The number is odd."; return 0; }