Welcome to Dream.In.Code
Getting C++ Help is Easy!

Join 136,573 C++ Programmers for FREE! Get instant access to thousands of C++ experts, tutorials, code snippets, and more! There are 1,917 people online right now. Registration is fast and FREE... Join Now!




nested loop printing

 
Reply to this topicStart new topic

nested loop printing

upant
11 Apr, 2008 - 08:12 PM
Post #1

D.I.C Head
**

Joined: 15 Feb, 2008
Posts: 84

CODE
ostream &operator<<(ostream &output, const Array2D &a)
{
    for( int i = 0; i <a.row;i++)
    {
        output<<setw(4)<<a.ptr[i];
        for( int j = 0; j <a.column;j++)
        {
            output <<setw(4) <<a.ptr[j];
        }
        output<<endl;

    }
    return output;
}



row and column are privare variables...
how can I print in respective row and column??

User is offlineProfile CardPM
+Quote Post

KYA
RE: Nested Loop Printing
12 Apr, 2008 - 01:49 AM
Post #2

#include <nerd.h>
Group Icon

Joined: 14 Sep, 2007
Posts: 4,924



Thanked: 105 times
Dream Kudos: 1200
My Contributions
Is it giving you an undefined error when compiling? You can pass row and column as parameters if you want.
User is offlineProfile CardPM
+Quote Post

Reply to this topicStart new topic
Time is now: 12/3/08 12:01AM

Live C++ Help!

C++ Tutorials

Reference Sheets

C++ Snippets

DIC Chatroom

Bye Bye Ads

Monthly Drawing

Thumb Drive

Top Contributors

Top 10 Kudos This Month