//Debug的都快疯了……要不要那么难Debug,记录一些心得以及BUG以备忘
当使用指针指向另一个类的时候,若想使用那个类里的函数,需要 s->Func()的形式:
ProductNode *s=new ProductNode; //NEW 一个新的结点
sin>>tmpNO>>tmpName>>tmpBrand>>tmpPrice>>tmpQuantity;
s->setNO(tmpNO);
s->setName(tmpName);
s->setBrand(tmpBrand);
s->setPrice(tmpPrice);
s->setQuantity(tmpQuantity);
InitInsert(s);
一个常用的登陆密码验证函数:
//判断密码//
bool ProductList::JudgeCode() const
{
bool power=true;
while(1)
{
char goon;
cout<<"输入用户名:";
string name;
cin>>name;
cout<<"输入6位密码:";
char code[7];
for(int i=0;i<7;i++)
{
code[i]=_getch();//#include<conio.h>
if(i<6)cout<<'*';
}
cout<<endl;
if(name=="okcd00"&&code[0]=='o'&&code[1]=='k'&&code[2]=='c'&&code[3]=='d'&&code[4]=='0'&&code[5]=='0')
break;
else cout<<"用户名或密码错误,是否重新输入?(y/n):";
cin>>goon;
if(goon=='n') {power=0;break;};
}
return power;
}