Results 1 to 13 of 13

Thread: [RESOLVED] There is some thing wrong with my code

Threaded View

  1. #1

    Thread Starter
    Hyperactive Member FireKnox101's Avatar
    Join Date
    Aug 2005
    Location
    Snohomish,Washington
    Posts
    301

    Resolved [RESOLVED] There is some thing wrong with my code

    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.

    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");
    }
    Dont mind my sort hand.

    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:
    Last edited by sunburnt; Jan 8th, 2006 at 12:55 AM. Reason: code tags

    Im currently using: VB.NET 2003, And VB 2005 Express
    My Projects
    Form Them Show Keypress In App
    Simple Ping Control

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width