Thread: an error! Want shall I do?

  1. #1
    Registered User stuart_cpp's Avatar
    Join Date
    Apr 2006
    Location
    UK
    Posts
    31

    an error! Want shall I do?

    I have an error! The error was "cin >> c;" and the error message was
    `c' undeclared (first use this function)
    I dont know how to correct it! PLease help!

  2. #2
    Supermassive black hole cboard_member's Avatar
    Join Date
    Jul 2005
    Posts
    1,709
    What's your second name? I might know you... a Stu from the UK I've been looking for recently.
    Good class architecture is not like a Swiss Army Knife; it should be more like a well balanced throwing knife.

    - Mike McShaffry

  3. #3
    Its hard... But im here swgh's Avatar
    Join Date
    Apr 2005
    Location
    England
    Posts
    1,688
    You have to delare a variable before you can use it.

    In your example, if c is a number type, do this

    Code:
    int c;
    if c is a character type, do this

    Code:
    char c;
    Remeber to delcare all variables you will be using in the main function to make them
    local - try not to use global ( declared outside main ) as they can cause confusion.

Popular pages Recent additions subscribe to a feed