c++ - cant figure out what to write for the last string of code for function -
hi guys have far function , question asking me write function findpattern()
receive 3 integers representing 3 bowling scores. function determine pattern followed these scores, printing 1 of following six cases (make sure have these 6 cases):
stayed same –- 3 scores same increasing –- scores going steadily upward decreasing –- scores going steadily downward , down –- scores first went up, went down down , –- scores first went down, went 2 same –- 2 consecutive scores same, , other 1 (first or third) either higher or lower
this have far can't figure out last part appreciated
void findpattern(int score1, int score2, int score3) { if (score1 == score2 && score1 == score3 && score2 == score3 ) { cout << "all 3 scores same" << endl; } else if (score1 < score2 && score2 < score3) { cout << "the scores going steadily upward" << endl; } else if (score1 > score2 && score2 > score3) { cout<<"the scores going steadily downward"<<endl; } else if(score1 < score2 && score2 > score3) { cout << "the scores first went up, went down" << endl; } else if (score1 > score2 && score2 < score3) { cout<<"the scores first went down, went up"<<endl; }
else if ( ( ( score1 == score2 ) && score2 != score3 ) || ( ( score2 == score3 ) && ( score2 != score1 ) ) ) cout << "two scores equal" << endl;
Comments
Post a Comment