1answer.
Ask question
Login Signup
Ask question
All categories
  • English
  • Mathematics
  • Social Studies
  • Business
  • History
  • Health
  • Geography
  • Biology
  • Physics
  • Chemistry
  • Computers and Technology
  • Arts
  • World Languages
  • Spanish
  • French
  • German
  • Advanced Placement (AP)
  • SAT
  • Medicine
  • Law
  • Engineering
Evgesh-ka [11]
3 years ago
11

Your friend is working on a Lab experiment to decide which insect is the fastest. You will help your friend and write an algorit

hm and a C++ program that allows your friend to enter the names of the insects and the measured speed of each insect. The names of the insects and the measured speeds should be stored in two arrays. The program should then sort and print the insects in descending order based on their speed. Your program should also output the name of the fastest insect.
Computers and Technology
1 answer:
7nadin3 [17]3 years ago
3 0

Answer:

#include <iostream>

#include <string>

using namespace std;

int main()

{

    int size=100;

   float insect_speed [size];

   string insect_name [100]={""};

int max=0;

int max_index=0;

for(int i=0;i<size;i++){

   

   cout<<"insect speed"<<endl;

cin>>insect_speed[i];

cin.ignore();

   cout<<"insect name"<<endl;

   getline(cin,insect_name[i]);

if(insect_speed[i]>max){

   max=insect_speed[i];

   max_index=i;

}

   cout<<"Fastest insect is "<<insect_name[max_index]<<" with speed "<<insect_speed[max_index]<<endl;

}

   return 0;

}

Explanation:

Initially took max size of 100. Using string define an string array of size for insect name and float array of size for speeds.

Define a variable max and set to 0 and a max_index and set to 0. max index will store the index of maximum value in array of speed.

For every input of speed check if it greater than max set max to current input vale of speed and max_index to current index of array.

print speed and insect name at max_index for fastest insect.

System will calculate fastest insect at run time an update user after every input.

You might be interested in
To find your personal learning style you can
JulsSmile [24]
Https://simplelifestrategies.com/sls-learningstyle/ this list may help ypu decide
6 0
3 years ago
Read 2 more answers
Which of the following is caused by wind erosion?
laila [671]
I'm not sure, but I think that  C : topsoil removal <span>is caused by wind erosion. I hope it helps</span>
7 0
3 years ago
Read 2 more answers
Write a program to sort the (name, age, score) tuples by descending order where name is string, age and score are numbers. The s
zimovet [89]

Answer:

The program in Python is as follows:

from operator import itemgetter

m = int(input("Number of records: "))

print("Name, Age, Score")

my_list =[]

for i in range(m):

   user_details = input()

   my_list.append(tuple((user_details.split(","))))

my_list.sort(key =  itemgetter(0, 1, 2))        

print("Sorted: ", my_list)

Explanation:

This imports the operator function from itemgetter

from operator import itemgetter

This gets the number of records, m

m = int(input("Number of records: "))

This prints the format of input

print("Name, Age, Score")

This initializes the list of tuples

my_list =[]

This iterates through m

for i in range(m):

This gets the details of each person

   user_details = input()

This appends the details to the tuple

   my_list.append(tuple((user_details.split(","))))

This sorts the tuple

my_list.sort(key =  itemgetter(0, 1, 2))        

This prints the sorted tuple

print("Sorted: ", my_list)

6 0
3 years ago
Traceability of requirements is helpful in the followingexcept
larisa86 [58]

Answer: D)  Identifying GUI's for a particular requirement

Explanation:

 Traceability of requirements is helpful except identifying GUI's for a particular requirements as, traceability in project management describe the relationships between two or more element throughout in the development process and outline the relationship between the customer requirement by traceability matrix. And the requirement of traceability is so important because it creating a downstream flow of software and test cases in software requirement but not helpful in GUI identification.

6 0
4 years ago
If a computer reboots itself on its own the computer might have a(n)
MissTica

Answer:

D. Software Problem

Explanation:

It could be that the software is bootlooping which will power on and off until its fixed.

4 0
3 years ago
Other questions:
  • A word or line of a paragraph at the top of a page hanging indent is called ______
    8·1 answer
  • ______________ is only one of the marketing mix tools that acompany uses to achieve its marketing objectives.
    7·1 answer
  • What were the goals of the “paperless society” ideal?
    14·2 answers
  • You are an interior decorator, confronted with a dark living room. To lighten the room up, you have n candles and want to build
    12·1 answer
  • the type() function in python does what when you give it an object. returns the last keystrokes from the user. fill the object w
    9·1 answer
  • Number 20, can anyone help?
    11·1 answer
  • What is the ability for a system to respond to unexpected failures or system crashes as the backup system immediately and automa
    8·1 answer
  • The processing power of a computing device is measured by its _____.
    10·1 answer
  • Besides earning money why do people work​
    6·2 answers
  • Write a program that first reads in the name of an input file and then reads the input file using the file.readlines() method. T
    11·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!