Is this a "find five problems"?
You don't need that much code to make me loose my lunch, surely this can easily be written without goto's:
Code:
if (x<1) {
cout << "We begin counting at 0. Please try again.\n"; goto Start;}
Note that I'm not religiously against goto's, just think they should be avoided when there is a better, simpler alternative.
Also, your error message doesn't seem to match exactly with the if-statement.
Second problem:
This is a pointer to memory, but it's never assigned to any particular memory location, so it's going to crash, I suspect. Use a char variable, and pass the address to read.
Third problem:
Code:
cout.write (buffer,1);
This will display the ascii character (or whatever the local font representation of the data is), not the hex-value. To show a hex value, you need something like
Code:
cout << hex << buffer;
Fourth problem:
Code:
cout << "Press 1 for YES or any other key for NO: ";
cin >> y;
This would fail if the user types in "a" for an answer.
Problem five:
Code:
if (y == !1) {goto End;}
End:
So, not only do you use goto for ABSOLUTELY no reason, your if-statement is also not doing what you expect - not that you'd notice, because you end up at exactly the same place whether the if-statement is true or not, as there is no code between the goto and the lable end, but I challenge you to find a way to NOT print the message in this code:
Code:
if (y == !1) {goto End;}
cout << "Got here" << endl;
End:
--
Mats