Please help me to do question 19 by using PYTHON.  And the code below is the code that does not suit for python, maybe you can help me out on why it cannot be use for python or provide me a new code. Thanks a lot       #include using namespace std; string players[20]; int arr[20],ptr=1; void add(string name,int score); void showPlayers(); int search(string player); void removes(string player); int main () {    int ch,score;    string name;    while(1)    {         cout<<"Choose option"<>ch;         switch(ch)         {             case 1: cout<<"Enter player name and score"<>name;                     cin>>score;                     add(name,score);                     break;             case 2: showPlayers();                     break;             case 3: cout<<"Enter player name"<>name;                     search(name);                     break;             case 4: cout<<"Enter player name"<>name;                     removes(name);                     break;             case 5: exit(0);             default:cout<<"wrong choice Enter again"<

Computer Networking: A Top-Down Approach (7th Edition)
7th Edition
ISBN:9780133594140
Author:James Kurose, Keith Ross
Publisher:James Kurose, Keith Ross
Chapter1: Computer Networks And The Internet
Section: Chapter Questions
Problem R1RQ: What is the difference between a host and an end system? List several different types of end...
icon
Related questions
Question
Please help me to do question 19 by using PYTHON. 
And the code below is the code that does not suit for python, maybe you can help me out on why it cannot be use for python or provide me a new code. Thanks a lot
 
 
 
#include <bits/stdc++.h>
using namespace std;
string players[20];
int arr[20],ptr=1;
void add(string name,int score);
void showPlayers();
int search(string player);
void removes(string player);
int main ()
{
   int ch,score;
   string name;
   while(1)
   {
        cout<<"Choose option"<<endl;
        cout<<"1 .Add a new player and score"<<endl;
        cout<<"2 .Print all players and scores"<<endl;
        cout<<"3 .Search for a player score"<<endl;
        cout<<"4 .Remove a player and score "<<endl;
        cout<<"5 .Quit"<<endl;
        cin>>ch;
        switch(ch)
        {
            case 1: cout<<"Enter player name and score"<<endl;
                    cin>>name;
                    cin>>score;
                    add(name,score);
                    break;
            case 2: showPlayers();
                    break;
            case 3: cout<<"Enter player name"<<endl;
                    cin>>name;
                    search(name);
                    break;
            case 4: cout<<"Enter player name"<<endl;
                    cin>>name;
                    removes(name);
                    break;
            case 5: exit(0);
            default:cout<<"wrong choice Enter again"<<endl;
        }
   }
}
void add(string name,int score)
{
   players[ptr]=name;
   arr[ptr]=score;
   ptr++;
}
void showPlayers()
{
   int i=1;
   cout << "player" << setw( 13 ) << "score" << endl;
   while(i<ptr)
   {
       cout << players[i] << setw( 13 ) << arr[i]<< endl;  
       i++;  
   }
}
int search(string name)
{
    int i=1,found=0;
    while(i<ptr)
    {
       if(players[i]==name)
       {
           cout<<"score: "<<arr[i]<<endl;
           found=1;
           return i;
       }
       i++;  
   }
   if(found==0)
   {
       cout<<"the player's name was not entered";  
       return 0;
   }
}
void removes(string name)
{
    int i;
    i=search(name);
    if(i)
    {
        while(i<ptr)
        {
           players[i]=players[i+1];
           arr[i]=arr[i+1];
           i++;
        }
        ptr--;      
    }  
}
Borepresents a
outputs the time elapsed fre
seconds.
bour ug Ie
Static and Automatic L
19. Write a a of up to 10 and scores
The output the is 4 and
should store the player's name and the array store the player's
In 10 11, will learn a way to related
in the Use two arrays to the array
high score. Use the of the the name the score.
Programming Tip: Define Pointe
54 pon wG (OL WW 22)
Pitfa
For example, given the strings:
molamit uord A
11:58:10 PM
12:02:15 AM
enpacdricur
cal
8 10 2191
Conlain a
e noib
sm5 seconds.
a
Cusbr
should store the player's name and the other array should store the pllay
high score. Use the index of the arrays to correlate the name with thecis
In Chapters 10 and 11, you will learn a different way to organize relae.
data by putting them into a struct or class. Your program
the following features:
of a specific type, you decl
ordinary varable of thate
name For example, the fe
can hold pointers to var
should support
a. Add a new player and score. If it is one of the top 10 scores then ad a
it to the list of scores. The same name and score can appear multiple
times. For example, if Bill played 3 times and scored 100, 100 and
99, and Bob played once and scored 50, then the top scores would
LAZd, d, 2u
1sdi bas (291yd bollo
be Bill 100, Bill 100, Bill 99, Bob 50.
CLE
b. Print the top 10 names and scores to the screen sorted by score with
the highest score first. bloda i bas 19dmun a 6 19 o1
jochon
n C. Allow the user to enter a player name and output that player's highest
score if it is on the top 10 list or a message if the player's name has
not been input or is not in the top 10.
d. Allow the user to enter a player name and remove the highest score
for that player from the list. 21 to 1dmun VIsuidis ns
pCL OL 2e
auj lo beoiani 9
porboon lliw oY.enoim
Create a menu system that allows the user to select which option to
invoke.
GL p
the adtes
Chapter Summary
Answers to Self-Te
Transcribed Image Text:Borepresents a outputs the time elapsed fre seconds. bour ug Ie Static and Automatic L 19. Write a a of up to 10 and scores The output the is 4 and should store the player's name and the array store the player's In 10 11, will learn a way to related in the Use two arrays to the array high score. Use the of the the name the score. Programming Tip: Define Pointe 54 pon wG (OL WW 22) Pitfa For example, given the strings: molamit uord A 11:58:10 PM 12:02:15 AM enpacdricur cal 8 10 2191 Conlain a e noib sm5 seconds. a Cusbr should store the player's name and the other array should store the pllay high score. Use the index of the arrays to correlate the name with thecis In Chapters 10 and 11, you will learn a different way to organize relae. data by putting them into a struct or class. Your program the following features: of a specific type, you decl ordinary varable of thate name For example, the fe can hold pointers to var should support a. Add a new player and score. If it is one of the top 10 scores then ad a it to the list of scores. The same name and score can appear multiple times. For example, if Bill played 3 times and scored 100, 100 and 99, and Bob played once and scored 50, then the top scores would LAZd, d, 2u 1sdi bas (291yd bollo be Bill 100, Bill 100, Bill 99, Bob 50. CLE b. Print the top 10 names and scores to the screen sorted by score with the highest score first. bloda i bas 19dmun a 6 19 o1 jochon n C. Allow the user to enter a player name and output that player's highest score if it is on the top 10 list or a message if the player's name has not been input or is not in the top 10. d. Allow the user to enter a player name and remove the highest score for that player from the list. 21 to 1dmun VIsuidis ns pCL OL 2e auj lo beoiani 9 porboon lliw oY.enoim Create a menu system that allows the user to select which option to invoke. GL p the adtes Chapter Summary Answers to Self-Te
Expert Solution
steps

Step by step

Solved in 2 steps with 1 images

Blurred answer
Recommended textbooks for you
Computer Networking: A Top-Down Approach (7th Edi…
Computer Networking: A Top-Down Approach (7th Edi…
Computer Engineering
ISBN:
9780133594140
Author:
James Kurose, Keith Ross
Publisher:
PEARSON
Computer Organization and Design MIPS Edition, Fi…
Computer Organization and Design MIPS Edition, Fi…
Computer Engineering
ISBN:
9780124077263
Author:
David A. Patterson, John L. Hennessy
Publisher:
Elsevier Science
Network+ Guide to Networks (MindTap Course List)
Network+ Guide to Networks (MindTap Course List)
Computer Engineering
ISBN:
9781337569330
Author:
Jill West, Tamara Dean, Jean Andrews
Publisher:
Cengage Learning
Concepts of Database Management
Concepts of Database Management
Computer Engineering
ISBN:
9781337093422
Author:
Joy L. Starks, Philip J. Pratt, Mary Z. Last
Publisher:
Cengage Learning
Prelude to Programming
Prelude to Programming
Computer Engineering
ISBN:
9780133750423
Author:
VENIT, Stewart
Publisher:
Pearson Education
Sc Business Data Communications and Networking, T…
Sc Business Data Communications and Networking, T…
Computer Engineering
ISBN:
9781119368830
Author:
FITZGERALD
Publisher:
WILEY