Thread: function problem using drawCircleChar

  1. #1
    Registered User
    Join Date
    Sep 2003

    function problem using drawCircleChar

    I'm trying to write a program that uses the function drawCircleChar and the character should be 'X'.
    However, I keep getting various error messages like undeclared symbol, etc.

    Could anyone please help me out - I'm not sure what I'm doing wrong.

    #include <iostream>
    using namespace std;
    // Functions used.....
    void drawCircleChar(char symbol);		// Draws a circle
    void drawTriangle();				// Draws a triangle
    void drawIntersect();				// Draws intersecting lines
    void drawBase();					// Draws a horizontal line
    int main ()
    // Draw a circle.
    	// Draw a triangle.
    	// Draw intersecting lines.
    	return 0;
    // Draws a circle.
    void drawCircleChar(char X)
    	cout << "   " << symbol << endl;
    	cout << " " << symbol << "   " << symbol << endl;
    	cout << "  " << symbol << " " << symbol << endl;
    }  // end drawCircleChar
    // Draws a triangle.
    void drawTriangle()
    }	// end drawTriangle
    // Draws intersecting lines.
    void drawIntersect()
    	cout << "   /\\  " << endl;
    	cout << "  /  \\ " << endl;
    	cout << " /    \\" << endl;
    }	// end drawIntersect
    // Draws horizontal line
    void drawBase()
    	cout << " ------" << endl;
    }	// end drawBase
    I know the character 'X' needs to be declared somewhere, I'm just not sure how to go about doing this.

    Thanks in advance.

  2. #2
    Master of the Universe! velius's Avatar
    Join Date
    Sep 2003
    In your function header for drawCircleChar(char symbol) you changed symbol to X and did not change the reference to symbol to X in the functions body.
    While you're breakin' down my back n'
    I been rackin' out my brain
    It don't matter how we make it
    'Cause it always ends the same
    You can push it for more mileage
    But your flaps r' wearin' thin
    And I could sleep on it 'til mornin'
    But this nightmare never ends
    Don't forget to call my lawyers
    With ridiculous demands
    An you can take the pity so far
    But it's more than I can stand
    'Cause this couchtrip's gettin' older
    Tell me how long has it been
    'Cause 5 years is forever
    An you haven't grown up yet
    -- You Could Be Mine - Guns N' Roses

  3. #3
    Registered User
    Join Date
    Sep 2003
    I changed all drawCircleChar to read "drawCircleChar(char X)"
    but that doesn't tell the program what to do for symbol.
    I' still getting the error message
    "undeclared identifier"

    I've been trying to follow the textbook, but it's not very clear - it's definitely not "C++ for Dummies!"
    Last edited by sweetly; 09-22-2003 at 07:08 PM.

  4. #4
    Registered User
    Join Date
    Oct 2001
    Take your original code and change this:
    >void drawCircleChar(char X)
    To this:
    void drawCircleChar(char symbol)

  5. #5
    Registered User
    Join Date
    Sep 2003
    Yes! That made it work. Thanks very much!!!!!

  6. #6
    Registered User major_small's Avatar
    Join Date
    May 2003
    jeebus, they still use that program?!
    Join is in our Unofficial Cprog IRC channel
    Channel: #Tech

    Team Cprog Folding@Home: Team #43476
    Download it Here
    Detailed Stats Here
    More Detailed Stats
    52 Members so far, are YOU a member?
    Current team score: 1223226 (ranked 374 of 45152)

    The CBoard team is doing better than 99.16% of the other teams
    Top 5 Members: Xterria(518175), pianorain(118517), Bennet(64957), JaWiB(55610), alphaoide(44374)

    Last Updated on: Wed, 30 Aug, 2006 @ 2:30 PM EDT

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. doubt in c parser coding
    By akshara.sinha in forum C Programming
    Replies: 4
    Last Post: 12-23-2007, 01:49 PM
  2. Including lib in a lib
    By bibiteinfo in forum C++ Programming
    Replies: 0
    Last Post: 02-07-2006, 02:28 PM
  3. Please Help - Problem with Compilers
    By toonlover in forum C++ Programming
    Replies: 5
    Last Post: 07-23-2005, 10:03 AM
  4. Problem with function pointers
    By vNvNation in forum C++ Programming
    Replies: 4
    Last Post: 06-13-2004, 06:49 AM
  5. structure vs class
    By sana in forum C++ Programming
    Replies: 13
    Last Post: 12-02-2002, 07:18 AM