displaying with rows and colums

This is a discussion on displaying with rows and colums within the C++ Programming forums, part of the General Programming Boards category; i need to display my out put in rows and colums like the this Height--> 67 68 69 70 71 ...

  1. #1
    Registered User tio1225's Avatar
    Join Date
    Sep 2005
    Posts
    6

    displaying with rows and colums

    i need to display my out put in rows and colums like the this

    Height--> 67 68 69 70 71 72 73

    Weight:
    120
    130
    140
    150 THE ACTUAL BodyMassIndex DATA SHOULD APPEAR
    160
    170 IN HERE NICELY FORMATTED
    180
    190
    200
    210
    220
    230
    can some one help this is what i have so far my data is correct just need help with out put display

    Code:
    #include <iomanip>
    using namespace std;
    
    int main ()
    {
       int weight_in_pounds = 120;
       
       int i,x;
       float weight_in_kilograms, height_in_meters, BodyMassIndex;
       cout <<"   Height-->  67      68      69      70      71      72      73\n";
       cout << "weight\n";
       for(x=12; x>=1; x--)
       	{
    	    int height_in_inches = 67;
    	   	for(i=0; i<=6; i++)
       		{
    	   		
    	   	    weight_in_kilograms = weight_in_pounds / 2.2;
           		height_in_meters = height_in_inches / 39.37;
           		BodyMassIndex = weight_in_kilograms / (height_in_meters * height_in_meters);
     	   		//cout <<" \n ";
       		    cout << setprecision(2) << fixed << weight_in_pounds <<" "<< BodyMassIndex;
     	   		height_in_inches ++;
     	   		
       		}
       		cout <<" \n ";
       		weight_in_pounds = weight_in_pounds + 10;
    	}	  
      system("pause");
             return 0;
    }
    Last edited by tio1225; 09-23-2005 at 05:47 PM.

  2. #2
    Registered User tio1225's Avatar
    Join Date
    Sep 2005
    Posts
    6
    i figured it out

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Swapping rows in a 2D array
    By bassist11 in forum C Programming
    Replies: 5
    Last Post: 03-11-2010, 12:04 PM
  2. printing rows and columns
    By datainjector in forum C# Programming
    Replies: 1
    Last Post: 08-03-2003, 06:42 PM
  3. Rows and colums
    By Aluvas in forum C++ Programming
    Replies: 3
    Last Post: 11-14-2002, 10:18 PM

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