Hello everyone, I'm currently reading "C++ Weekend Crash Course" by Stephen R. Davis. This is the first book I've read about C++. I'm still learining the basics. Anyways, In the chapter about "Logical Operations" there is a section focusing on "working with binary numbers", "performing bitwise operations", and "creating logical assignment statements". The book provides code for a "bitwise operator test". Here's the part that doesnt seem to work for me.
Code:// input the first argument int nArg1; cout << "Enter arg1 as a four-digit hexadecimal: "; cin >> nArg1; //***Right here*** int nArg2; cout << "Enter arg2: "; cin >> nArg2; cout << "nArg1 & nArg2 =0x" << (nArg1 & nArg2) << "\n"; cout << "nArg1 | nArg2 = 0x" << (nArg1 | nArg2) << "\n"; cout << "nArg1 ^ nArg2 = 0x" << (nArg1 ^ nArg2) << "\n";
Everytime I run the program it works fine until it gets to the second argument. It skips right past the whole part of the code begining at "int nArg2; cout << "Enter arg2: "; cin >> nArg2;"
and goes right into the next lines of code. Everything looks right to me. I've played around with programs that were more complex then this one and have gotten them working correctly. Any help would be greatly appreciated. I'm using Dev-C++.
Oh and another thing, when I run my compiled programs soon as it gets to the end of the program the DOS prompt closes not giving me enough time to read my programs usally. Anyone know how I can remedy this? I've searched around through Dev-C++ looking for an option that would allow me to keep the programs open even after there finished but couldnt find anything. Thanks.