1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125
| #include <iostream> #include <conio.h> #include <fstream> #include <string> #include<string.h> using namespace std; # include <math.h> # define U 0.06 # define V 0.025 # define M 1.1 # define N 1.2 //逐个字符验证密码 int cmp(char *g,char *b){ int k; for(k=0;k<6;k++){ if(g[k]!=b[k]) break; } if(k==6) return 1; } //密码验证 int mmyz() { int i,j; int z=0; char g[6],b[]={"971228"};//设置初始密码 cout<<"请输入系统的6位初始密码(密码是你的生日)"<<endl; for(i=0;i<3;i++) { for(j=0;j<6;j++) { g[j]=getch(); cout<<"*"; } if(cmp(g,b)==1) //调用密码比较函数 { cout<<"密码正确"<<endl; cout<<"成功进入系统"<<endl; break; } else { cout<<endl<<"密码错误,请重新输入"<<endl; z++; } if(z==3) { cout<<"禁止登陆"<<endl; break; } } return(z); } void printxin() { float x, y; float m, n; for ( y=2; y>=-2; y-=U ) { for ( x=-1.2; x<=1.2; x+=V) { if ( ( ( (x*x + y*y - 1)*(x*x + y*y - 1)*(x*x + y*y - 1) - x*x*y*y*y ) <= 0 ) ) printf("*"); else printf(" "); } printf("\n"); } } void panduan(){ int k=0; char s1[30]={"喜欢"}; char s2[30]={"不喜欢"}; char s3[30]={}; printf("我这么可爱,你喜不喜欢我!\n"); printf("输入喜欢还是不喜欢!\n"); scanf("%s",s3); if(strcmp(s1,s3)==0) { float x, y; float m, n; for ( y=2; y>=-2; y-=U ) { for ( x=-1.2; x<=1.2; x+=V) { if ( ( ( (x*x + y*y - 1)*(x*x + y*y - 1)*(x*x + y*y - 1) - x*x*y*y*y ) <= 0 ) ) printf("*"); else printf(" "); } printf("\n"); } getchar(); printf("我也喜欢你!"); } //if(strcmp(s2,s3)==0) else { panduan(); } } int main(){
int m; m=mmyz(); if(m==3){ printf("..........................\n"); } else{ //当密码正确时 panduan(); /*int j; j=panduan(); if(j==0){ j=panduan(); } if(j==1) { }*/ } return 0; }
|