Hi im using Visual Studio.net 2003 C++ and i just bought this book Called
Hacker Disassembling Uncouvered and the first project is to type a simple code that makes a login type thing and i typed it word for word from the book and i get all these errors here is the code i typed in and the ERRORS.
Dont mind my sort hand.Code:// macthing the pass char wwith the corrwect car. // basicly making a login screen if pass is ok then go if pass is wrong the display message, #include <stdio.h> #include <string.h> #define PASSWORD_SIZE 100 #define PASSWORD "myGODpassword\n" // cr above is need //so as not to cut it off // the user enterd CR int_main() { //the counter for authentication failurs int count=0; //buffer size for the user-entered password char buff[PASSWORD_SIZE], //main authentication loop for(;;) { //prompt the user for pass //and read it printf("enter password: "); fgets(&buff[0],PASSWORD_SIZE,stdin); //matching the entered pass with the referenced one if (strcmp(&buff[0],PASSWORD)) //"scolding if the pass is wrong printf("WRONG PASSWORD\n"); //otherwise if pass matches then go on //getting out of loop else break; //incrementing the counter of authentication failures //and terminating the program if 3 attempts have been used if (++count>3) return -1 } //once we're here, the user has entered the right pass printf("Password OK\n"); }
here are the errors
-Projects\simple\simple.cpp(21): error C2059: syntax error : 'for'
-Projects\simple\simple.cpp(21): error C2143: syntax error : missing ';' before ')'
-Projects\simple\simple.cpp(22): error C2143: syntax error : missing ';' before '{'
-Projects\simple\simple.cpp(34): error C2043: illegal break
-Projects\simple\simple.cpp(39): error C2143: syntax error : missing ';' before '}'
I hope you guys or girls can help. :wave:





Reply With Quote