Thread: Program not seeing the if statement

  1. #1
    Registered User
    Join Date
    Jun 2004
    Posts
    3

    Question Program not seeing the if statement

    Hey everyone,

    First post here but and I can not see why when I run this section of the program it skips right over the if statement like it is not even there. Here is the code and the compiler I am using is MS Visual C++ version 6.0

    Code:
    #include "stdafx.h"
    
    void create()
    {
    	char name[21]="";
    	int confirm=0;
    
    	printf("Welcome to Character Creation please answer the following questions.\n");
    
    location0: ;
    
    	printf("What is your characters name?\n");
    
    	scanf("%s",&name);
    
    	printf("Your name is %s\n",name);
    
    	printf("Is this correct? (0 for yes/1 for No)\n");
    	
    	if(confirm==1)
    	{
    		goto location0;
    	}
    
    	printf("works?\n");
    
    
    }
    Thanks for any and all help the if statement with the problem is in red.

    ~J

  2. #2
    Code Goddess Prelude's Avatar
    Join Date
    Sep 2001
    Posts
    9,897
    >int confirm=0;
    >if(confirm==1)
    I get the feeling that your test is failing.
    My best code is written with the delete key.

  3. #3
    Registered User
    Join Date
    Jun 2004
    Posts
    3

    Got it

    Got it thanks

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Need help with my program...
    By Noah in forum C Programming
    Replies: 2
    Last Post: 03-11-2006, 07:49 PM
  2. Need help with my program, please take a look
    By Hermisky in forum C++ Programming
    Replies: 2
    Last Post: 02-02-2006, 10:13 AM
  3. Dikumud
    By maxorator in forum C++ Programming
    Replies: 1
    Last Post: 10-01-2005, 06:39 AM
  4. Replies: 3
    Last Post: 01-14-2003, 10:34 PM