A
alternativa
Hi,
I'd like to obtain an output looking as follows:
name number phone address
Caroline 233 34234 White St. 12
Anna 929043 093284 Brown St. 325
To do this (I mean to obtain constant field length for data of the same
type, even if strings are of different lengths) I tried to use setw(X)
from <iomanip.h>, so I wrote something like this:
cout << "name " << "phone " << "address" << endl;
cout << setw(15) << name << setw(10) << << number << setw(10)
phone << setw(20) << address << endl;
The problem is that the compiler returns a warning:
#warning This file includes at least one deprecated or antiquated
header. \
Please consider using one of the 32 headers found in section 17.4.1.2
of the \
C++ standard. Examples include substituting the <X> header for the
<X.h> \
header for C++ includes, or <iostream> instead of the deprecated header
\
<iostream.h>. To disable this warning use -Wno-deprecated.
What can I do to avoid it? Is there any other method for formatting the
output?
I'd like to obtain an output looking as follows:
name number phone address
Caroline 233 34234 White St. 12
Anna 929043 093284 Brown St. 325
To do this (I mean to obtain constant field length for data of the same
type, even if strings are of different lengths) I tried to use setw(X)
from <iomanip.h>, so I wrote something like this:
cout << "name " << "phone " << "address" << endl;
cout << setw(15) << name << setw(10) << << number << setw(10)
phone << setw(20) << address << endl;
The problem is that the compiler returns a warning:
#warning This file includes at least one deprecated or antiquated
header. \
Please consider using one of the 32 headers found in section 17.4.1.2
of the \
C++ standard. Examples include substituting the <X> header for the
<X.h> \
header for C++ includes, or <iostream> instead of the deprecated header
\
<iostream.h>. To disable this warning use -Wno-deprecated.
What can I do to avoid it? Is there any other method for formatting the
output?