printSquare( side ); ???

This is a discussion on printSquare( side ); ??? within the C++ Programming forums, part of the General Programming Boards category; Code: #include<iostream> #include<conio.h> using std::cout; using std::cin; using std::endl; // function prototype void printSquare( int ); int main() { // ...

  1. #1
    o0o
    o0o is offline
    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 wrongness Salem's Avatar
    Join Date
    Aug 2001
    Location
    The edge of the known universe
    Posts
    32,494
    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.
    I support http://www.ukip.org/ as the first necessary step to a free Europe.

  3. #3
    o0o
    o0o is offline
    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, 09:59 PM

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21