help with spacing in C++ program
From: Lilly (amarylis_cruz_at_yahoo.com)
Date: 11/05/04
- Next message: Tim Rentsch: "Re: Programming Challenge"
- Previous message: Dik T. Winter: "Re: Not STD C is "not C" ? ----WAS: Re: C to Java Byte Code"
- Next in thread: Ulrich Eckhardt: "Re: help with spacing in C++ program"
- Reply: Ulrich Eckhardt: "Re: help with spacing in C++ program"
- Reply: AngleWyrm: "Re: help with spacing in C++ program"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Date: 4 Nov 2004 20:30:27 -0800
Hi,
It's me again. I need help with spacing and making the second set of
numbers appear next to the first set of numbers. I would like the
second sequence of numbers to appear right under the title Second. If
anyone can guide me on how to accomplish this I would really
appreciate it. Here is my program.
#include <iostream.h>
#include <iomanip.h>
int main()
{
const int NUMROWS = 2;
const int NUMCOLS =3;
int i,j;
int first[NUMROWS][NUMCOLS] = {16,18,23,54,91,11};
int second[NUMROWS][NUMCOLS]={24,52,77,16,19,59};
int element[NUMROWS][NUMCOLS];
cout<<"\n First\t\t\tSecond"
<<"\n _____________________________________";
for (i=0;i<NUMROWS;i++)
{
cout<<endl;
for(j=0;j<NUMCOLS;j++)
cout<<setw(4)<<first[i][j];
}
cout<<endl;
for (i=0;i<NUMROWS;i++)
{
cout<<endl;
for(j=0;j<NUMCOLS;j++)
cout<<setw(4)<<second[i][j];
}
cout<<endl;
cout<<"\n Element";
cout<<"\n ___________";
for(i=0;i<NUMROWS;i++)
{
cout<<endl;
for(j=0;j<NUMCOLS;j++)
{
element[i][j]= first[i][j] + second[i][j];
cout<<setw(4)<<element[i][j];
}
}
cout<<endl;
return 0;
}
Thanks for the help,
Lilly
- Next message: Tim Rentsch: "Re: Programming Challenge"
- Previous message: Dik T. Winter: "Re: Not STD C is "not C" ? ----WAS: Re: C to Java Byte Code"
- Next in thread: Ulrich Eckhardt: "Re: help with spacing in C++ program"
- Reply: Ulrich Eckhardt: "Re: help with spacing in C++ program"
- Reply: AngleWyrm: "Re: help with spacing in C++ program"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]