Thread: outputting a report arrays of structures

  1. #1
    Registered User
    Join Date
    Apr 2005

    outputting a report arrays of structures

    i want to make an output that is going to be 18 down and 3 across. i have a structure made with 3 elements. how do i go about with a for loop to output the 3 columns. like a data table

    	int x,x2;
    		for(x=0; x<18; x++)
    	cout<<"ID Code		Income		Members"<<endl;
    		cout<<array[x].code<<"		";

  2. #2
    Join Date
    Mar 2005
    are you familiar with the header file <iomanip> and function setw()? read up on those and they will help you with your problem.

    you will want to space them apart using setw() when you print each line.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Replies: 2
    Last Post: 05-13-2009, 12:57 PM
  2. Replies: 3
    Last Post: 05-09-2009, 11:06 AM
  3. pointers to arrays of structures
    By terryrmcgowan in forum C Programming
    Replies: 1
    Last Post: 06-25-2003, 09:04 AM
  4. errors with arrays and structures
    By ssjnamek in forum C++ Programming
    Replies: 4
    Last Post: 03-03-2002, 11:48 PM
  5. Newbie Help (Arrays, Structures, Functions,Pointers)
    By tegwin in forum C++ Programming
    Replies: 3
    Last Post: 02-19-2002, 06:29 PM