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:
- How to Solve error C2039: “to_ String “: not a member of” STD “
- MOTR compiling error: cannot call member function ‘void std::basic_string<_CharT, _Traits, _Alloc>::_R
- No match for ‘operator =’ both ends of the equal sign do not match
- [Solved] runtime error: reference binding to null pointer of type ‘std::vector<int, std::allocator<int>>‘
- [Solved] VScode Run C++ File Error: fatal error:opencv2\core.hpp:No such file or diretory
- [Solved] std::max() error C2589: ‘(‘ : illegal token on right side of ‘::‘
- Oracle prompt text does not match format string
- C++ Error: terminating with uncaught exception of type std::out_of_range: vector Abort trap: 6
- [Solved] Vscode debug error launch: Program “path” does not exist
- Cmake Error The C compiler identification is GNU 7.5.0 — The CXX compiler identification is unknown
- [Solved] VScode Error: PS D:\vscode> cd “d:\vscode\“ ; if ($?) { g++ tempCodeRunnerFile.cpp -o tempCodeRunn
- [Solved] Vscode error: Unable to resolve resource walkThrough://vscode_getting_started_page
- Mac Vscode C++ Customize Header File Error: linker command failed
- [Solved] QT Programme Error: error: no matching function for call to…
- How to Solve Fatal error stdatomic in C/C++ Compilation
- TensorFlow-gpu Error: failed call to cuInit: CUDA_ERROR_NO_DEVICE: no CUDA-capable device is detected
- Qt error: no matching function for call to ‘MainWindow::connect(QAction*&, void (QAction::*)
- How to parse JSON string in.Net [error reading job object from jsonreader. Current jsonreader item is not an obj]
- How to Solve “Status bar could not find cached time string image. Rendering in-process.” in Xcode
- VSCode Unable to find custom header file directory: fatal error: no such file or directory