RE: c++ "cout" causing problems

  • From: Chris Meredith <cmered@xxxxxxxxxxxxx>
  • To: "programmingblind@xxxxxxxxxxxxx" <programmingblind@xxxxxxxxxxxxx>
  • Date: Sat, 16 Feb 2008 13:39:35 -0800

Alex,

Try the following:
Cout << h << ":" << m << ":" << s << endl;

As there is no implementation of Operator + that adds a string to an int or 
vice versa, but the above should concatenate the values and display them as 
you're wanting.

-C-

-----Original Message-----
From: programmingblind-bounce@xxxxxxxxxxxxx 
[mailto:programmingblind-bounce@xxxxxxxxxxxxx] On Behalf Of Alex Hall
Sent: Saturday, February 16, 2008 12:49 PM
To: programmingblind@xxxxxxxxxxxxx
Subject: c++ "cout" causing problems

Hi all,
I have not done c++ in a year or so, but even so this should work
fine:
cout << int+":"+int+":"+int;
It causes the program to not compile, though; when I comment it
out it works fine, but when I leave it says something about the +
operator (I cannot review my errors very easily in the ide I
have).  What is going on? The statement should not have any
problems.  Oh, "int" are 3 variable names, h, m, and s.  Thanks
for any help.

Have a great day,
Alex
__________
View the list's information and change your settings at
//www.freelists.org/list/programmingblind

__________
View the list's information and change your settings at
//www.freelists.org/list/programmingblind

Other related posts: