2.0
作者:
tyjz_yyds
,
2022-04-04 16:17:11
,
所有人可见
,
阅读 191
#include<bits/stdc++.h>
using namespace std;
//fit_algorithm 契合度算法函数.
char a[5],b[5];
int as,bs,fit_degree,fit_degree_ans;
string name1,name2;
//算法保密.
//***
int fit_algorithm(){
for(int i=0;i<3;i++){
a[i]=name1[i];
if(a[i]!='#'&&a[i]>='a'&&a[i]<='z')
as+=int(a[i]);
if(a[i]=='#') as+='n';
}
for(int i=0;i<3;i++){
b[i]=name2[i];
if(a[i]!='#'&&b[i]>='a'&&b[i]<='z')
bs+=int(b[i]);
if(b[i]=='#') bs+='n';
}
fit_degree=as+bs;
fit_degree/=6;
return fit_degree;
}
//***
//算法保密.
int main(){
printf("欢迎来到UNLO(United Nations Love Organization)联合国爱情组织夫妻契合度评测系统!\n\n");
printf("Welcome to WLO (World Love Organization) United Nations love organization husband and wife fit evaluation system!\n\n");
printf("请输入夫妻名字首字母(小写)!\n\n");
printf("Please enter the initials of the couple's name (lower case)!\n\n");
puts("如果名字有四个字,则输入名字前三个字!如果名字有两个字,则输入名字首字母末尾带上 # .");
cin>>name1>>name2;
cout<<"\n\n契合度计算中……\n\n";
_sleep(2000);
fit_degree_ans=fit_algorithm();
if(fit_degree_ans>=100){
cout<<"无敌夫妻!契合度为"<<100<<"%";
return 0;
}
else if(fit_degree_ans>=80&&fit_degree<100){
cout<<"完美夫妻!契合度为"<<fit_degree_ans<<"%";
return 0;
}
else if(fit_degree_ans>=50&&fit_degree<80){
cout<<"挺配的呀!契合度为"<<fit_degree_ans<<"%";
return 0;
}
else{
cout<<"......还是算了吧......契合度为"<<fit_degree_ans<<"%";
return 0;
}
return 0;
}