是不是编译器有问题呢
#include<iostream>#include<cassert>
using namespace std;
void dename(const string& fullname,string& firstname,
string& middlename,string& lastname);
int main()
{
cout<<"enter a fullname:";
string fullname;
getline(cin,fullname);
string fname,mname,lname;
dename(fullname,fname,mname,lname);
cout<<fname<<endl;
cout<<mname<<endl;
cout<<lname<<endl;
}
#include<cassert>
using namespace std;
void dename(const string& fullname,string& firstname,
string& middlename,string& lastname);
{
int firstblankindex=fullname.find(' ',0);
assert(firstblankindex!=string::npos);
firstname=fullname.substr(0,firstblankindex);
int secondblankindex=fullname.find(' ',firstblankindex+1);
assert(secondblankindex!=string::npos);
middlename=fullname.substr(firstblankindex+1,
secondblankindex-firstblankindex+1);
int fullnamesize=fullname.size();
lastname=fullname.substr(secondblankindex+1,
fullnamesize-secondblankindex-1);
这是书上的一个例题,但不知道为什么总是过不了编译, 是不是编译器有问题呢??