Answer to Question #265404 in C++ for Abdullah

Question #265404

suppose we have top teams they are like that with their points

pakistan=99

india=52

bangladesh=80

Nz=72

sl=45

wi=84

now we have to find the top 3 teams



1
Expert's answer
2021-11-13T12:04:16-0500
#include <iostream>


using namespace std; 


int main(int argc, char *argv[]){
	int sc[6];
	for(int i = 0; i < 6;i++){
		cin >> sc[i];
	}
	for(int i = 0; i<6; i++) {
   for(int j = i+1; j<6; j++)
   {
      if(sc[j] > sc[i]) {
         int temp = sc[i];
         sc[i] = sc[j];
         sc[j] = temp;
      }
   }
}
	cout << sc[0] <<endl << sc[1] <<endl << sc[2] <<endl;
}

Need a fast expert's response?

Submit order

and get a quick answer at the best price

for any assignment or question with DETAILED EXPLANATIONS!

Comments

No comments. Be the first!

Leave a comment

LATEST TUTORIALS
New on Blog
APPROVED BY CLIENTS