From 4c5639c466fd421666fff22816976f0f97d2761f Mon Sep 17 00:00:00 2001 From: Asadashino <13937936+Asadashino3@user.noreply.gitee.com> Date: Tue, 4 Jun 2024 15:20:20 +0800 Subject: [PATCH] changed --- cppfile/test3.cpp | 95 +++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 95 insertions(+) create mode 100644 cppfile/test3.cpp diff --git a/cppfile/test3.cpp b/cppfile/test3.cpp new file mode 100644 index 0000000..f28c92a --- /dev/null +++ b/cppfile/test3.cpp @@ -0,0 +1,95 @@ +#include +#include +#include +#include // cout +#include // find +#include // vector +#include + +using namespace std; +int findsame(char ip,char com[]){ + int lengt; + lengt = sizeof(com); + for (int i = 0; i d1[11]; + char common[11]; + int *p; + int *q; + int oi = 0; + int budeng; + scanf("%d",&num); + for (int i = 0;ibegin(),d1->end(),resu[k][oi]); + if (p !=d1->end){ + continue; + } + else{ + d1->push_back(resu[k][oi]) + } + oi++; + } + for (int secp = 5;secp < 9;secp++){ + p = find(d1->begin(),d1->end(),resu[k][secp]); + if (p !=d1->end){ + continue; + } + else{ + d1->push_back(resu[k][secp]) + } + } + } + else{ + budeng = k; + continue; + } + } + } + for (int fp = 0;fp<4;fp++){ + q = find(d1->begin(),d1->end(),resu[budeng][fp]); + if (q != d1->end){ + if(resu[budeng][9] == 'u'){ + printf('%c is the counterfeit coin and it is light.',resu[budeng][fp]); + } + else{ + printf('%c is the counterfeit coin and it is heavy.',resu[budeng][fp]); + } + + break; + } + + } + for (int fp1 = 5;fp1<9;fp1++){ + q = find(d1->begin(),d1->end(),resu[budeng][fp1]); + if (q != d1->end){ + if(resu[budeng][9] == 'u'){ + printf('%c is the counterfeit coin and it is heavy.',resu[budeng][fp1]); + } + else{ + printf('%c is the counterfeit coin and it is light.',resu[budeng][fp1]); + } + break; + } + + } + + + } + \ No newline at end of file