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]
4 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]4 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
The basic PowerPoint template has a simple presentation format with two text boxes, title and _____.
stiks02 [169]

Question: The basic PowerPoint template has a simple presentation format with two text boxes, title and ____

Answer: slide show

Explanation: this is the most logical answers because after all those steps in the presentation this is the next one


Question: The main reason many users have access to Outlook is to manage their e-mail communications and their

Answer: calendering

Explantion: this is used for messsaging and contacts and you also use it for to put important stuff on your calender

question answered by

(jacemorris04)

7 0
4 years ago
Read 2 more answers
Computer C’s performance is 4 times as fast as the performance of computer B, which runs a given application in 28 seconds. How
slamgirl [31]

Answer:

112

Explanation:

Since computer C's performance is 4 times faster, naturally I'd multiply 28 by 4.

6 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
The Apple ll is an IBM compatible PC “clone.”<br><br> True <br><br> False
aliya0001 [1]

Answer is: False


<u>Explanation:</u>

IBM PC compatible computers are computers similar to the original IBM PC, XT, and AT, able to use the same software and expansion cards. Such computers used to be referred to as PC clones, or IBM clones.

<u>PC clone:</u>

In computer programming, particularly object-oriented programming, cloning refers to object copying by a method or copy factory function, often called clone or copy , as opposed to by a copy constructor.

7 0
4 years ago
Write the definition of a void function that finds the integer value of an ascii character
irina [24]

The code below is in Java.

It converts the given character to corresponding integer value by creating a function. We use type casting to get the integer value of a character.

I also included the main part so that you can test it.

You can see the output in the attachment.

Comments are used to explain each line of code.

public class Main

{

public static void main(String[] args) {

 //call the function in the main

 convertASCIIToInt('k');

}

//create a function named convertASCIIToInt that takes a character as an argument

public static void convertASCIIToInt(char c) {

    //convert the argument to an int using type casting

    int asciiValue = (int) c;

   

    //print the result

    System.out.println("The integer value of " + c + " is " + asciiValue);

}

}

You may see another function example in the following link

brainly.com/question/13925344

8 0
3 years ago
Other questions:
  • An outdoor products company wants to test a new website design where customers can get information about their favorite outdoor
    6·1 answer
  • In excel, a cell is referred to by its cell __________, which is the coordinates of the intersection of a column and a row. answ
    14·1 answer
  • The _______ is a small program run by a computer when first powered on. its primary function is to stabilize the machine and dev
    11·1 answer
  • What function does a security certificate perform
    15·2 answers
  • When is a chart legend used
    8·2 answers
  • 4. What are five actions you should do to care for your camera?
    15·1 answer
  • Killer app is BEST described as:
    5·1 answer
  • Explain with example how does delay marriage help for population management​
    6·1 answer
  • Write a program that receives a series of numbers from the user and allows the user to press the enter key to indicate that he o
    10·1 answer
  • Complete two examples of how scientists, technologists, engineers, and mathematicians may work together to create a new product
    5·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!