让我们说我想与CVS评论匹配,如:
// $Source$
我的正则表达式目前看起来像这样:
if ( /^\/\/\s*\$Source\$/ =~ line)
哪个有效,但我想知道 - 有更好的方式来写这个吗?
答案 0 :(得分:0)
使用class Node
{
private:
int guestID;
string name;
string surname;
string season;
int year;
int nights;
string payMethod;
string purpose;
string membership;
Node* nextPtr;
public:
// Constructor function
Node(int, string, string, string,int, int, string, string, string);
//Accessor functions
int getID() { return guestID; }
string getName() { return name; }
string getSurname() { return surname; }
string getSeason() { return season; }
int getYear() { return year; }
int getNights() { return nights; }
string getpayMethod() { return payMethod; }
string getPurpose() { return purpose; }
string getMembership() { return membership; }
Node* getNext() { return nextPtr; }
string getData();
//Mutator functions
void setID(int num) { guestID = num; }
void setName(string str) { name = str; }
void setSurname(string str) { surname = str; }
void setSeason(string str) { season = str; }
void setYear(int yr) { year = yr; }
void setNights(int totNights) { nights = totNights; }
void setpayMethod(string payment){ payMethod = payment; }
void setPurpose(string str) { purpose = str; }
void setMembership(string str) { membership = str; }
void setNext(Node* ptr){nextPtr = ptr;}
};
语法:
%r