不知道该为函数的最后一个代码字符串写什么

cant figure out what to write for the last string of code for function

本文关键字:代码 字符串 什么 最后一个 函数 不知道      更新时间:2023-10-16

嗨,伙计们,这是我迄今为止对函数的了解,问题是让我写一个函数findpattern(),它将接收代表三个保龄球得分的三个整数。该功能将确定这些分数所遵循的模式,打印以下六种情况之一(确保您有这六种情况):

  stayed the same –- all three scores were the same 
  increasing –- the scores are going steadily upward
  decreasing –- the scores are going steadily downward
  up and down –- the scores first went up, then went down
  down and up –- the scores first went down, then went up
  two the same –- two consecutive scores were the same, and the
 other one (first or third) was either higher or lower     

这就是我到目前为止所拥有的,我不知道最后一部分,任何帮助都将不胜感激

void findpattern(int score1, int score2, int score3)
{
   if (score1 == score2 && score1 == score3 && score2 == score3 )
   {
      cout << "all three scores were the same" << endl;
   } else if (score1 < score2 && score2 < score3) {
      cout << "the scores are going steadily upward" << endl;
   } else if (score1 > score2 && score2 > score3) {
      cout<<"the scores are going steadily downward"<<endl;
   } else if(score1 < score2 && score2 > score3) {
      cout << "the scores first went up, then went down" << endl;
   } else if (score1 > score2 && score2 < score3) {
      cout<<"the scores first went down, then went up"<<endl;
   }
else if ( ( ( score1 == score2 ) && score2 != score3 ) || ( ( score2 == score3 ) && ( score2 != score1 ) ) )
    cout << "two scores are equal" << endl;

你可以试试这个:

else if((score1==score2 || score2==score3) && ( (score1 > score3) || (score1 < score3)))
    cout<<"two the same";