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
Xelga [282]
3 years ago
9

p3_unzip :: [(a,b)] -> ([a], [b]) Write a function that takes a list of two-tuples and returns a tuple of two lists -- the fi

rst containing the first element of each tuple, and the second the second element (i.e., the reverse of "zip"). Examples: > p3_unzip [('a',1),('b',5),('c',8)] ("abc",[1,5,8])
Computers and Technology
1 answer:
klio [65]3 years ago
4 0

Answer:

<em>C++.</em>

Explanation:

#include <iostream>

#include<tuple>

using namespace std;

////////////////////////////////////////////////////////////

tuple<char*, int*> p3_unzip(tuple<char, int>* list, int count) {

   char* list1 = new char[count];

   int* list2 = new int[count];

   

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

       tuple<char, int> temp = list[i];

       list1[i] = get<0>(temp);

       list2[i] = get<1>(temp);

   }

   

   tuple<char*, int*> new_tuple;

   get<0>(new_tuple) = list1;

   get<1>(new_tuple) = list2;

   

   return new_tuple;

}

int main() {

   tuple<char, int>* list;

   int count = 0;

   ////////////////////////////////////////

   cout<<"How many tuples? ";

   cin>>count;

   list = new tuple<char, int>[count];

   cout<<endl;

   

   char a;

   int b;

   tuple<char, int> temp;

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

       cout<<"tuple "<<i+1<<" char: ";

       cin>>a;

       get<0>(temp) = a;

       

       cout<<"tuple "<<i+1<<" int: ";

       cin>>b;

       get<1>(temp) = b;

       

       list[i] = temp;

       cout<<endl;

   }

   ////////////////////////////////////////

   tuple<char*, int*> new_tuple = p3_unzip(list, count);

   char* list1 =  get<0>(new_tuple);

   int* list2 = get<1>(new_tuple);

   

   cout<<"Returned tuple:([";

   for (int i=0; i<count-1; i++) {

       cout<<list1[i]<<", ";

   }

   

   cout<<list1[count-1]<<"],[";

   

   for (int i=0; i<count-1; i++) {

       cout<<list2[i]<<", ";

   }

   

   cout<<list2[count-1]<<"])";

   ////////////////////////////////////////

   delete[] list, list1, list2;

   return 0;

}

You might be interested in
Which of the following lets you insert a Clip Art image?
kolbaska11 [484]

Answer:if you have a computer plug into the side

Explanation:

I

6 0
4 years ago
What is the main purpose of broadcasting via satellite? A. To enable signal reception at night B. To convert analog signals to d
Natali5045456 [20]

Answer:

The answer is "Option C".

Explanation:

Satellite transmission is a content distribution program, that utilizes digital signals to transmit from satellites that receive parabolic antennas widely known as satellite dishes. It's a  low noise block generator for transmitted to cooling. It also allows the user it accepts single in a wide area, and the wrong choice can be defined as follows:

  • In choice a, It allows the uses to receive a signal at all times, that's why it is wrong.
  • In choice b, It provides digital signals,  that's why it is wrong.
  • In choice d, It is wrong because it always provides quality signals.  

 

8 0
3 years ago
In your opinion, what are the Pros and Cons of employers using Video Surveillance?
Stella [2.4K]

Answer: Video surveillance is the digital system used in the organization for the capturing of the video and storing it for monitoring .It is used for the security purpose of the business. The pros and cons of this system is mentioned as follows:-

<u>Pros:</u>

  • Providing security in business field
  • Decrements in the crime rate
  • Provides 24x7 monitoring and surveillance
  • Serving real -time information

<u>Cons:</u>

  • Costly investment
  • Needs more devices for installation in large organizations
  • Created privacy concerns
  • Overloading of data storage in the form video can happen

5 0
3 years ago
What are the key ideas in dealing with a superior?
Radda [10]
Respect is a key requirement for a healthy work environment. It promotes teamwork and increases productivity and efficiencies in the workplace. It lets employees know they are valued for their abilities, qualities and achievements, and that their role is important to their company's success.
5 0
3 years ago
If a firm puts Internet-facing servers directly in the Internet, they are exposed to threats of attack from anywhere in the worl
djverab [1.8K]

Answer:

True.

Explanation:

If a firm puts servers that are internet facing directly on the internet then the servers are exposed to external attacks and these attacks can be from anywhere in the world.

The server becomes vulnerable or unsafe and attackers can attack and can manipulate or tamper the server code from anywhere in the world.

8 0
4 years ago
Other questions:
  • The only item on the desktop of a new Mac is the hard-drive icon. <br><br> True or false?
    9·1 answer
  • A computer with 5 stage pipeline like the one descrive in class delas with conditional branches by stalling for the next three c
    5·1 answer
  • II. MULTIPLE CHOICE (five points each)
    9·1 answer
  • What are binary code​
    7·2 answers
  • In which view are fields set up in MS Access?
    11·2 answers
  • When thinking of laptops, which brands come to mind?
    12·2 answers
  • Help me plz and thank .......................................
    6·2 answers
  • Why would a virtual machine be useful in a school? It provides a completely secure connection to the internet. Students can coll
    12·1 answer
  • A server is handling thousands of simultaneous connections, and proxying requests to another service. Which concurrency model is
    9·1 answer
  • What would the theoretical variance (square of the standard deviation) of the following random values be? rand(Normal(80, 10), 2
    11·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!