Thread: Please help me with this error

  1. #1
    Registered User
    Join Date
    Mar 2006
    Posts
    9

    Please help me with this error

    I have problem with this portion of program..I executed it but it showed this type of error


    "ttt.c", line 163: Error: "}" expected instead of "defined".
    "ttt.c", line 165: Error: "}" expected instead of "defined".
    2 Error(s) detected.

    line 163 refers to scnf("%d",&choice);
    line 165 refers to switch(choice)

    I compile using Sun Microsystem.
    This is the program.

    Code:
    #include<stdio.h>
    int main()
    {
    int choice=0; /* this just holds the answer for the menu */
    char playagain = 'y'; /* y to play again, n to quit */
     
     do
     {  
     
    
     printf("     T  I  C\n");
     printf("    -----------\n");
     printf("     T  A  C\n");
     printf("    -----------\n");
     printf("     T  O  E");
     printf("\n\n");
     printf("Type 1 to proceed and type 0 to quit\n");
    
    printf("Choice : ");
    
    scanf("%d", &choice);
    
    switch (choice)
     {
    case 0   : printf("Thank you for playing TIC TAC TOE.\n");
                playagain = 'n';
                break;
     default  : printf("ERROR!\n");
                break;
     }
     
    
    
    }
    while (playagain == 'y');
    
    return 0;
    }
    Last edited by rinaishlene; 04-05-2006 at 10:08 PM.

  2. #2
    Registered User
    Join Date
    Feb 2006
    Posts
    32
    Code:
    #include <stdio.h>
    simple typo

    -michael

  3. #3
    Registered User
    Join Date
    Mar 2006
    Posts
    9
    still it is not the one who caused the problem

  4. #4
    Registered User
    Join Date
    Feb 2006
    Posts
    32
    if thats the full code which is giving you the error then the fix i gave you should remedy your problem...i'm a freshman in college taking my first c-programming class so thats all the help i can provide for the provided code.

    compiled and ran fine in my c-compiler

    jGrasp on Windows Home Edition

    uses gcc...i think

    please correct me (someone) if i'm missing something

    -michael

  5. #5
    ATH0 quzah's Avatar
    Join Date
    Oct 2001
    Posts
    14,826
    Try posting the whole thing, and not just some fragment of it. Somehow I doubt the above program is the whole thing. Unless 165 lines just isn't what it used to be...


    Quzah.
    Hope is the first step on the road to disappointment.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Getting an error with OpenGL: collect2: ld returned 1 exit status
    By Lorgon Jortle in forum C++ Programming
    Replies: 6
    Last Post: 05-08-2009, 08:18 PM
  2. An error is driving me nuts!
    By ulillillia in forum C Programming
    Replies: 5
    Last Post: 04-04-2009, 09:15 PM
  3. Making C DLL using MSVC++ 2005
    By chico1st in forum C Programming
    Replies: 26
    Last Post: 05-28-2008, 01:17 PM
  4. Connecting to a mysql server and querying problem
    By Diod in forum C++ Programming
    Replies: 8
    Last Post: 02-13-2006, 10:33 AM
  5. Couple C questions :)
    By Divx in forum C Programming
    Replies: 5
    Last Post: 01-28-2003, 01:10 AM