Thread: printSquare( side ); ???

  1. #1
    Registered User o0o's Avatar
    Join Date
    Dec 2003
    Posts
    37

    Unhappy printSquare( side ); ???

    Code:
    #include<iostream>
    #include<conio.h>
    
    using std::cout;
    using std::cin;
    using std::endl;
    
    // function prototype
    
    void printSquare( int );
    
    int main()
    {
        // declare variable
        
        int side;
        
        // read side
        
        cout<<"enter square side:";
        cin>> side;
        
        // display square
        
        printSquare( side );
        
        
    getch();
    }
    
    // define printSqaure
    
    void printSqaure( int userchoice )
    {
        for( int i=1; i<=userchoice; i++ )
        {
            cout<<endl;
            for( int j=1; j<=userchoice; j++)
            cout<< '*' ;
        }
    }
    It does not print asterick square(*)

    ****
    ****
    ****
    ****

    Where is the fault?

    It gives the following error

    [Linker error]undefined reference to'printsquare(int)'

  2. #2
    and the hat of int overfl Salem's Avatar
    Join Date
    Aug 2001
    Location
    The edge of the known universe
    Posts
    39,660
    It means you can't spell square properly

    void printSquare( int );
    void printSqaure( int userchoice )
    If you dance barefoot on the broken glass of undefined behaviour, you've got to expect the occasional cut.
    If at first you don't succeed, try writing your phone number on the exam paper.

  3. #3
    Registered User o0o's Avatar
    Join Date
    Dec 2003
    Posts
    37

    Smile

    lol hahaaa !!

    Thanku very much salem.
    I will now keep spellings in mind.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. OpenGL example cube is black, white, grey only
    By edwardtisdale in forum Windows Programming
    Replies: 7
    Last Post: 09-22-2007, 02:37 PM
  2. Strange side effects?
    By _Elixia_ in forum C Programming
    Replies: 4
    Last Post: 08-16-2005, 03:25 PM
  3. Stupid Logic Problem Need Outside Viewpoint
    By RP319 in forum C++ Programming
    Replies: 5
    Last Post: 03-03-2005, 10:59 PM