473,626 Members | 3,343 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

cout no operator matches these operands error

momotaro
357 Contributor
Hi,
am trying to output the value of a string variable like this:
Expand|Select|Wrap|Line Numbers
  1. cout<<"I am: " <<this->id <<endl;
the error is:
no operator matches these operands.

does it means that I have to overload the operator << ??

thank's in advance.
Jun 5 '11 #1
1 6481
weaknessforcats
9,208 Recognized Expert Moderator Expert
It looks like you have not included <string>.

Not all the string member functions are in <iostream>.
Jun 6 '11 #2

Sign in to post your reply or Sign up for a free account.

Similar topics

3
6978
by: Dave Bailey | last post by:
When running the following code: if (typeCheck.Checked == true && typeList.SelectedItem == "3") { return " and wopm3 = '3' or wopm3 = '3C' or wopm3 = '3I'"; } I get the following error: Operator '&&' cannot be applied to operands of type 'bool'
2
5319
by: DouggieC | last post by:
Hi, I am attempting to overload the '<' operator in order to sort an array structure, but get a syntax error in Borland Builder5. Code as follows: struct GroupTeamType { AnsiString Name; int Played; int Won;
3
1480
by: Pierre Barbier de Reuille | last post by:
Hi, after reading the article " The Standard Librarian : Defining Iterators and Const Iterators" from Matt Austern: http://www.ddj.com/showArticle.jhtml;jsessionid=41JODBZDWEMBYQSNDLOSKH0CJUNN2JVN?articleID=184401331 I wanted to test using the non-template function friends of template classes. So I devised this code: ===8<======8<======8<======8<======8<======8<======8<===
0
1178
by: help1267 | last post by:
Hi, I'm getting the follwoing error when I try the following operation in *** C# ***: Error: Operator '^' cannot be applied to operands of type 'float' and 'int' Operation: fltNumber ^ intNbr I've tried to assign the numbers different data types but it always gives me the same error.
0
2049
by: erik.erikson | last post by:
I am getting a compiler error that I can't well explain or even understand the origin of (though I boiled it down close...). Below is a bare-bones example. What I am doing is defining the increment operator in a class and then defining a derived class and using the derived class. When I try to use the increment operator on an instance of the derived class (as an instance of the derived class, not when used as an instance of the base...
1
2753
by: amhoov | last post by:
Hi all, OS - MacOS X 10.4.9 Compiler - gcc 4.0 (XCode) I'm *extremely* new to C++ (but have extensive experience with Java), so please go easy on me. I'm running into a very odd situation which I believe is related to template instantiation. I need to include a header file from a library
1
1441
by: kalki70 | last post by:
Hello, I have a doubt about this operator, and I haven't found the answer in internet (yet). When calling the operator << several times in an expression, are all parameters evaluated first and then passed to cout::<<, or are being passed when they are evaluated ? An example to clarify my question : int foo()
4
3007
by: Ares Lagae | last post by:
How is an output stream operator of a class nested in a class template defined? The code fragment below does not compile. Maybe it's just me, but I don't see why it should not compile. Best regards, #include <iostream> template <typename T> struct foo
1
2774
by: Terry Archer | last post by:
Error 1 error C2679: binary '>>' : no operator found which takes a right-hand operand of type 'std::string' (or there is no acceptable conversion) #include <iostream> #include <fstream> #include <iomanip> using namespace std; int main() { string lastName1, firstName1, lastName2, firstName2, lastName3, firstName3; double currentSalary1, currentSalary2, currentSalary3;
3
6638
by: Brett Turner | last post by:
I am writing a client chat program, however every time I try to compile it, I get the same errors over and over... IntelliSense: no operator ">>" matches these operands WSAData wsaData; int wVersion = 2; std::string password, userName; std::cout << "User Name : ";
0
8205
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,...
0
8713
Oralloy
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...
1
8370
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,...
0
8514
tracyyun
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...
0
7206
agi2029
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...
1
6126
isladogs
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...
0
4208
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
2632
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
2
1516
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.