错误:没有重载函数的实例;标准::getline“;匹配参数列表--参数类型为:(std::istream,char[50]) 全新(十分钟前)到堆栈溢出(大约一周)C++,但我正在努力寻找一个在线管理的图书馆管理系统,以查看类是如何工作的。我在这里找到了原始代码:我正试图找出如何让它运行。有些标题有点旧,所以我根据需要进行了更新和更改。遇到get()的问题,看到这里有人说这是一个坏习惯/不安全的做法,所以我将所有这些引用都更改为“std::getline”。但是,我现在遇到了一个问题,我无法解决为什么我的调试器在std下有波形。我得到“没有重载函数的实例”std::getline与参数列表匹配——参数类型是:(std::istream,char[50])。我不知道如何解决这个问题。任何帮助都将不胜感激 #include<iostream> #include<fstream> #include<conio.h> #include<stdio.h> #include<stdlib.h> #include<process.h> #include<string.h> #include<iomanip> #include<string> using namespace std; using std::cout; using std::getline; class book { char bno[6]; char bname[50]; char aname[20]; public: void create_book() { cout<<"\nNEW BOOK ENTRY...\n"; cout<<"\nEnter The book no."; cin>>bno; cout<<"\n\nEnter The Name of The Book "; std::getline(std::cin, bname); cout<<"\n\nEnter The Author's Name "; std::getline(std::cin,aname); cout<<"\n\n\nBook Created.."; } void show_book() { cout<<"\nBook no. : "<<bno; cout<<"\nBook Name : "; puts(bname); cout<<"Author Name : "; puts(aname); } void modify_book() { cout<<"\nBook no. : "<<bno; cout<<"\nModify Book Name : "; std::getline(std::cin,bname); cout<<"\nModify Author's Name of Book : "; std::getline(std::cin,aname); } char* retbno() { return bno; } void report() {cout<<bno<<setw(30)<<bname<<setw(30)<<aname<<endl;} }; #包括 #包括 #包括 #包括 #包括 #包括 #包括 #包括 #包括 使用名称空间std; 使用std::cout; 使用std::getline; 课堂用书 { char-bno[6]; char bname[50]; char aname[20]; 公众: void create_book() { cout

错误:没有重载函数的实例;标准::getline“;匹配参数列表--参数类型为:(std::istream,char[50]) 全新(十分钟前)到堆栈溢出(大约一周)C++,但我正在努力寻找一个在线管理的图书馆管理系统,以查看类是如何工作的。我在这里找到了原始代码:我正试图找出如何让它运行。有些标题有点旧,所以我根据需要进行了更新和更改。遇到get()的问题,看到这里有人说这是一个坏习惯/不安全的做法,所以我将所有这些引用都更改为“std::getline”。但是,我现在遇到了一个问题,我无法解决为什么我的调试器在std下有波形。我得到“没有重载函数的实例”std::getline与参数列表匹配——参数类型是:(std::istream,char[50])。我不知道如何解决这个问题。任何帮助都将不胜感激 #include<iostream> #include<fstream> #include<conio.h> #include<stdio.h> #include<stdlib.h> #include<process.h> #include<string.h> #include<iomanip> #include<string> using namespace std; using std::cout; using std::getline; class book { char bno[6]; char bname[50]; char aname[20]; public: void create_book() { cout<<"\nNEW BOOK ENTRY...\n"; cout<<"\nEnter The book no."; cin>>bno; cout<<"\n\nEnter The Name of The Book "; std::getline(std::cin, bname); cout<<"\n\nEnter The Author's Name "; std::getline(std::cin,aname); cout<<"\n\n\nBook Created.."; } void show_book() { cout<<"\nBook no. : "<<bno; cout<<"\nBook Name : "; puts(bname); cout<<"Author Name : "; puts(aname); } void modify_book() { cout<<"\nBook no. : "<<bno; cout<<"\nModify Book Name : "; std::getline(std::cin,bname); cout<<"\nModify Author's Name of Book : "; std::getline(std::cin,aname); } char* retbno() { return bno; } void report() {cout<<bno<<setw(30)<<bname<<setw(30)<<aname<<endl;} }; #包括 #包括 #包括 #包括 #包括 #包括 #包括 #包括 #包括 使用名称空间std; 使用std::cout; 使用std::getline; 课堂用书 { char-bno[6]; char bname[50]; char aname[20]; 公众: void create_book() { cout,c++,class,debugging,std,C++,Class,Debugging,Std,std::getline(std::cin,bname);->std::cin.getline(bname,50); 全局函数仅适用于std::basic_stringtype。成员函数仅适用于char[] 或者,您可以避免将来的麻烦,将char[]更改为std::string。总体上使用起来更容易 请注意。查看,您只需要3个标题,iostream、iomanip和string。更改为string bno;,等等。将put()更改为cout

std::getline(std::cin,bname);
->
std::cin.getline(bname,50);

全局函数仅适用于
std::basic_string
type。成员函数仅适用于
char[]

或者,您可以避免将来的麻烦,将
char[]
更改为
std::string
。总体上使用起来更容易


请注意。

查看,您只需要3个标题,
iostream
iomanip
string
。更改为
string bno;
,等等。将
put()
更改为
cout