In the original file, total. Isbn() = = trans. Isbn() will report an error in vscode, “unable to match the call error”
compile. CPP: 12:37: error: no match for call to ‘(STD:: _cxx11:: String
{aka STD:: _cxx11:: basic_string}) ()’
if (total. Isbn() = = trans. Isbn())
solution: remove the brackets after. Isbn() and change the primitive sentence to
if (total.isbn==trans.isbn)
The reason is that ISBN should be a parameter value rather than a method, or it may be caused by my environment. It is for reference only.
#include <iostream>
#include"Sales_item.h"
int main(){
Sales_item total;
if (std::cin>>total)
{Sales_item trans;
while (std::cin>>trans)
{
if (total.isbn()==trans.isbn())
total+=trans;
else
{
std::cout<<total<<std::endl;
total=trans;
}
}
std::cout<<total<<std::endl;
}
else{
std::cerr<<"NO Data?!"<<std::endl;
return -1;
}
return 0;
}
Read More:
- VTK GetScalarPointer() and GetScalarComponentAsFloat() not work
- [Solved] C++ Error: terminate called after throwing an instance of ‘char const‘
- [Solved] C++ error: undefined reference to `xxx‘
- Template argument deduction/substitution failed: couldn‘t deduce template parameter [How to Solve]
- No match for ‘operator =’ both ends of the equal sign do not match
- C++:error C2872: ‘byte‘: ambiguous symbol [How to Solve]
- [Solved] C++ reason ncnn model error: Segmentation fault (core dumped)
- How to Solve error C2039: “to_ String “: not a member of” STD “
- [Solved] MindSpore Error: “TypeError: parse() missing 1 required positional.”
- Clion new method shows undefined reference to solution
- [Solved] Opencv Error: Error: Assertion failed (data) in cv::Mat::at, file … mat.inl.hpp, line 897(Accessed pixels of non-existent matrix)
- Opencv c++ Read Video Error: capture.isOpened() Return false
- How to Solve Error: “initializer element is not constant”
- [Solved] JNI DETECTED ERROR IN APPLICATION: GetStringUTFChars received NULL jstring
- VSCode Error: collect2.exe:error:1d returned 1 exit status [How to Solve]
- The showdialog() method in thread/threading. Timer/task reported an error: “before ole can be called, the current thread must be set to single thread unit (STA) mode.”
- Runtime error prompt in Android Studio: arrayadapter requires the resource ID to be a textview problem
- TF Error: Error: TF_DENORMALIZED_QUATERNION [How to Solve]
- A mistake about implicitly providing default constructors
- Error (17) solves the problem of losing the request header of multithread asynchronous feign call