📄 lzp.ui.h
字号:
/****************************************************************************** ui.h extension file, included from the uic-generated form implementation.**** If you wish to add, delete or rename functions or slots use** Qt Designer which will update this file, preserving your code. Create an** init() function in place of a constructor, and a destroy() function in** place of a destructor.*****************************************************************************/char turenumber[5]="0000";int count;void lzp::starts(){ int i,j; srand(time(NULL)); turenumber[0]=rand()%9+0+'0'; for(i=1;i<4;i++) { turenumber[i]=rand()%9+0+'0'; for(j=i-1;j>=0;j--) { if(turenumber[i]==turenumber[j]) { i--; break; } } } GUESSButton->setEnabled(1); HELPButton->setEnabled(1); count=0;}void lzp::guess(){ char inputnum[5]="0000"; int i,j,a=0,b=0; inputnum[0]=spinBox1->value()+'0'; inputnum[1]=spinBox2->value()+'0'; inputnum[2]=spinBox3->value()+'0'; inputnum[3]=spinBox4->value()+'0'; for(i=0;i<4;i++) { for(j=0;j<4;j++) { if(turenumber[i]==inputnum[j]&&i==j) a++; else if(turenumber[i]==inputnum[j]&&i!=j) b++; } } if(count<10) { if(a==4) listBox->insertItem("Congratulations!!!!!!!!!!!!!!!!!!!!"); else listBox->insertItem(QString("%1 %2A%3B").arg(inputnum).arg(a).arg(b)); } else { listBox->insertItem("You have lost!!!!!!!!!!!!!!"); } count++;}void lzp::tureN(){ listBox->insertItem(turenumber);}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -