Page 3 of 4 FirstFirst 1234 LastLast
Results 21 to 30 of 38

Thread: C Problems

  1. #21
    Join Date
    Oct 2004
    Posts
    4,814
    Rep Power
    24

    Default Re: C Problems

    Ok. do this:
    remove getchar(); and compile it again. If you get no errors you can browse to the location of the program and run it from the command line. Also you could replace getchar(); with getch() from the conio.h library. Actually getchar() is just the c++ equivalent to getch().

  2. #22
    Join Date
    Aug 2004
    Posts
    2,789
    Rep Power
    0

    Default Re: C Problems

    Tried that already (getch() and conio.h) and i got the error:
    Info :Compiling C:\DOCUMENTS AND SETTINGS\myusername\...\BIN\noname01.cpp
    Error: noname01.cpp(26,26):Multiple declaration for 'RED'
    Error: conio.h(60,26):Earlier declaration of 'RED'
    Error: noname01.cpp(26,26):Multiple declaration for 'RED'
    Error: conio.h(60,26):Earlier declaration of 'RED'
    Error: noname01.cpp(26,26):Type mismatch in redeclaration of 'RED'
    Error: conio.h(60,26):Earlier declaration of 'RED'
    Error: noname01.cpp(27,26):Multiple declaration for 'BLUE'
    Error: conio.h(57,26):Earlier declaration of 'BLUE'
    Error: noname01.cpp(27,26):Multiple declaration for 'BLUE'
    Error: conio.h(57,26):Earlier declaration of 'BLUE'
    Error: noname01.cpp(27,26):Type mismatch in redeclaration of 'BLUE'
    Error: conio.h(57,26):Earlier declaration of 'BLUE'
    The views expressed in the above post are not neccesarily the views of icuucme.

  3. #23
    Join Date
    Oct 2004
    Posts
    4,814
    Rep Power
    24

    Default Re: C Problems

    ok. The constants BLUE and RED were already defined in conio.h library thats why they clash with the other declartion.

    Try this then:

    remove conio.h, getch(); and getchar();, then compile it. If it compiles use the stdlib.h library and use system("pause"); to pause the output.

  4. #24
    Join Date
    Aug 2004
    Posts
    2,789
    Rep Power
    0

    Default Re: C Problems

    YEAH!! It works..Thanks leoandru
    The views expressed in the above post are not neccesarily the views of icuucme.

  5. #25
    Join Date
    Nov 2004
    Posts
    249
    Rep Power
    0

    Default Re: C Problems

    can any body help me out im i need to write a program in c

  6. #26
    Join Date
    Nov 2004
    Posts
    249
    Rep Power
    0

    Default Re: C Problems

    and im havin a few problems with it,if u have the time please help me out ok

  7. #27
    Join Date
    Oct 2004
    Posts
    4,814
    Rep Power
    24

    Default Re: C Problems

    Quote Originally Posted by Spadez
    can any body help me out im i need to write a program in c
    umm.. yes we would be willing, but you need to provide more info..
    You can start by telling us whats your program about?

  8. #28
    Join Date
    Mar 2004
    Posts
    123
    Rep Power
    0

    Default Re: C Problems

    Quote Originally Posted by Spadez
    can any body help me out im i need to write a program in c
    We would if we knew what C program you need to write. Like, what's the problem to be solved
    There is no wrong or right, only consequencies to action

    "It is the duty of man to make his knowledge so complete in life, so as to make it impossible for any other to take advantage of him" - Marcus Garvey

  9. #29
    Join Date
    Aug 2004
    Posts
    2,789
    Rep Power
    0

    Default Re: C Problems

    Quote Originally Posted by leoandru
    remove conio.h, getch(); and getchar();, then compile it. If it compiles use the stdlib.h library and use system("pause"); to pause the output.
    What should i do if the program needs conio.h? eg. i have in clrscr() and that needs conio.h. Does that mean i cannot use the colour code?
    The views expressed in the above post are not neccesarily the views of icuucme.

  10. #30
    Join Date
    Oct 2004
    Posts
    4,814
    Rep Power
    24

    Default Re: C Problems

    Quote Originally Posted by icuucme
    What should i do if the program needs conio.h? eg. i have in clrscr() and that needs conio.h. Does that mean i cannot use the colour code?
    getchar(); should be able to work, i dont know why it wont work in borland. I recently installed the borland compiler so that i can help you guys out. when i reach home later i will try to find an alternative to conio.h that should be able to work.

    UPDATE:

    I am really tired i just realized that i answered the wrong question.

    If you want to clear the screen you can use system() function from stdlib.h. you can consider the system function as a command interface. So to clear the screen you will type system("cls"); in your code.
    Last edited by leoandru; Apr 8, 2005 at 05:57 PM.

Posting Permissions

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