Thread: my do while loop not working

Threaded View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Registered User
    Join Date
    Aug 2005
    Posts
    266

    my do while loop not working

    when i run my code even if i enter "yes" for the input it doesnt loop over. any idea?

    Code:
    #include <stdio.h>
    #include <string.h>
    int main()
    {
    int x;
    char tin[2];
    printf("\n");
    do{
    printf("enter a ascii value to see its corresponding character - ");
    scanf("%i", &x);
    printf(" \n  the ascii character of %i is %c \n \t Would you like to start over?(yes or no)", x , (char)x);
    
    fgets(tin, 2, stdin);
    getchar();
    }while(tin == "yes");
    }
    Last edited by rodrigorules; 09-06-2005 at 05:41 PM.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. "try again" loop not working
    By scwizzo in forum Game Programming
    Replies: 5
    Last Post: 04-01-2007, 09:56 PM
  2. Replies: 6
    Last Post: 07-19-2005, 01:03 PM
  3. EOF not working in a loop
    By Malabux in forum C++ Programming
    Replies: 3
    Last Post: 10-12-2003, 06:28 PM
  4. while() loop isn't working right..
    By Captain Penguin in forum C++ Programming
    Replies: 20
    Last Post: 10-03-2002, 10:29 PM
  5. How to change recursive loop to non recursive loop
    By ooosawaddee3 in forum C Programming
    Replies: 1
    Last Post: 06-24-2002, 08:15 AM