Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

Problem 2: Salesman Contest A company exective wants to arrange a contest and pr

ID: 3606960 • Letter: P

Question

Problem 2: Salesman Contest A company exective wants to arrange a contest and present prizes for the two top most salesmans wh sold highest number of the company goods, such as mobile phones. Write a program in C++ that prompts the user to enter number of contestents and number of goods sold by each salesman. The program then selects and prints the top two salesmans based on the number of goods sold. Sample input/ output: ter nunber of contestant ter nunber of sold itens for salesnan 1 432 ter nunber of sold itens for salesnan 2: 150 ter nunber of sold itens for salesnan 3: 359 ter nunber of sold itens for salesman 4: 498 ter nunber of sold itens for salesnan 5: 19 ter nunber of sold itens for salesnan 6: 57 ter nunber of sold itens for salesnan : 61? he Topnost is 617 econdis 14 he Second last is 498

Explanation / Answer

#include<iostream.h>
#include<conio.h>
void main()
{
   int usize,i,max,smax;
   clrscr();
   cout<<" Enter the Number of SalesMen :->";
   cin>>usize;
   //const int size=usize;
   int* smen=new int[usize];
   for(i=0;i<usize;i++)
   {
       cout<<" Enter the Number of Sold Item in Salesmen"<<i<<" :->";
       cin>>smen[i];
   }
   max=smen[0];
   for(i=0;i<usize;i++)
   {
       if(smen[i]>max)
       {
           max=smen[i];
       }
   }
   smax=smen[0];
   for(i=0;i<usize;i++)
   {
       if(smen[i]>max && smax!=max)
       {
           smax=smen[i];
       }
   }
   cout<<" The Topmos is :->"<<max;
   cout<<" The Second Topmos is :->"<<smax;
   getch();
}

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote