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? 4 8873
alternativa wrote: 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?
Use <iomanip>, not <iomanip.h>. You will also either have to qualify
things as being in the std namespace or put a "using namespace std;"
after your headers in your .cpp/.cc/.C file.
Cheers! --M
alternativa wrote: [..] I tried to use setw(X) from <iomanip.h>
There is no <iomanip.h> in the Standard C++ library. Only <iomanip>.
Try it. You may need to add 'std::' to your manipulators or add some
kind of 'using' declaration or directive. Read about "std" namespace.
[...]
What can I do to avoid it?
Stop using non-standard (deprecated) headers. It's been eight years
since standard has been in place, it's time for you to learn to use
standard headers.
Is there any other method for formatting the output?
You could use printf...
V
--
Please remove capital 'A's when replying by e-mail
I do not respond to top-posted replies, please don't ask
alternativa wrote:
[snipped] 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?
try:
#include <iostream>
#include <iomanip>
instead of
#include <iostream.h>
#include <iomanip.h>
Alan
alternativa <al***********@ wp.pl> wrote: 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:
[snip] 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>.
You are including the nonstandard <iomanip.h>. Instead, try #including
<iomanip> (no .h on the end). Note that a common convention for these
headers is that <iomanip.h> had symbols in the global namespace but
<iomanip> has them in namespace std, so you may need to:
1. Fully qualify the names (e.g., std::setw(10) instead of setw(10))
2. Use using-declarations (e.g., using std::setw;)
3. Use a using-directive (e.g., using namespace std)
I put these in my personal preference order, but see the FAQ for more
information.
--
Marcus Kwok
Replace 'invalid' with 'net' to reply This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics |
by: Eshrath |
last post by:
Hi,
What I am trying to do:
=======================
I need to form a table in html using the xsl but the table that is
formed is quite long and cannot be viewed in our application. So we
are writing one object in C# which will take the entire table tag
contents and renders. Ie., we need to pass "<table>…………
<thead>……</thead>. <tr>.<td> <td>..<tr>.<td> <td> </table>" content to
|
by: Donald Firesmith |
last post by:
I am having trouble having Google Adsense code stored in XSL converted
properly into HTML. The <> unfortunately become < and > and then
no longer work.
XSL code is:
<script type="text/javascript">
<!]>
</script>
<script type="text/javascript"
|
by: rupert |
last post by:
i've got the following code:
#include <iostream>
#include <string>
#include <vector>
#include <iomanip>
using namespace std;
int main(double argc, char* argv) {
double r = 0.01;
|
by: Ezmeralda |
last post by:
Hello,
I need to an TCP/IP Interface for communication with an embedded
device.
Since I have two different design ideas in mind, I am wondering
whether
you could give me some hints to decide:
Requirements:
- Interface should be used for company internal purposes/software but
|
by: ajay2552 |
last post by:
Hi,
I have a query.
All html tags start with < and end with >. Suppose i want to display either '<' or '>' or say some text like '<Company>' in html how do i do it?
One method is to use <, > ,<Company> to display '<', '>' and '<Company>' respectively.
But is there any freeware code available which could implement the above functionality without having to use >,< and such stuff???
| |
by: Michael |
last post by:
Since the include function is called from within a PHP script, why
does the included file have to identify itself as a PHP again by
enclosing its code in <?php... <?>
One would assume that the PHP interpreter works like any other, that
is, it first expands all the include files, and then parses the
resulting text. Can anyone help with an explanation?
Thanks,
M. McDonnell
|
by: newbie |
last post by:
Same thing g++ complains when using hash_map<>, but is happy with
map<--I understand hahs_map is not standardized, but since the
compiler didn't complain something like 'hash_map<not defined', I
suppose it's supported and should behave well when I used it
correctly. BUT it didn't.
Here is my code snippet:
class MyKey {
public:
virtual void foo() { return; }
|
by: Markus Dehmann |
last post by:
I have two integers i1 and i2, the second of which is guaranteed to be
between 0 and 99, and I encode them into one double:
double encoded = (double)i1 + (double)i2 / (double)100;
So, for example, 324 and 2 become 324.02. Now I want to decode them
using the function given below but it decodes the example as 324 and
1, instead of 324 and 2.
Can anyone tell me what's wrong and how to do this right? (my code see
|
by: Bernd Gaertner |
last post by:
Dear experts,
according to the standard, manipulators like noskipws are declared in
the header ios (). But when I look at code that is
around, I usually see #include<iomanipbeing used. What is the correct
include, and why?
Thanks in advance for your time!
Best regards,
|
by: marktang |
last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look !
Part I. Meaning of...
|
by: Hystou |
last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it.
First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
| |
by: Oralloy |
last post by:
Hello folks,
I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>".
The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed.
This is as boiled down as I can make it.
Here is my compilation command:
g++-12 -std=c++20 -Wnarrowing bit_field.cpp
Here is the code in...
|
by: Hystou |
last post by:
Overview:
Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
|
by: tracyyun |
last post by:
Dear forum friends,
With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
|
by: agi2029 |
last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own....
Now, this would greatly impact the work of software developers. The idea...
|
by: isladogs |
last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM).
In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules.
He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms.
Adolph will...
|
by: 6302768590 |
last post by:
Hai team
i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
| |
by: muto222 |
last post by:
How can i add a mobile payment intergratation into php mysql website.
| |