Question 2 Which of the following are not examples of correct usage (conceptually or syntactically) of auto_ptr? (Assume the needed header files have been included.) auto_ptr int> pia(new int[20]); auto_ptr (new string); intrigue = 7; auto_ptr
Q: operators, considering dynamic memory allocation: Operations: • length: determine the length of…
A: I have written the code below:
Q: Floating-point struct Part 1 Define a struct Single that describes the bit layout for a…
A: According to the information given:- We have to define the single precision floating point numbers.
Q: C Programming: Need help in how to create the code instrumentation in c. We will rely on gcc's…
A: so we have to find output using terminal with the help of - finstrument -functions
Q: YES / NO struct Node1 { uint16_t byte; }; YES / NO struct Node2 { int age; char name[64]; }; YES /…
A: 1. struct Node1{ unit16_t byte; }; Answer: this is the wrong structure declaration of…
Q: Using the CelsiusToKelvin function as a guide, create a new function, changing the name to…
A: C++ program to create a function KelvinToCelsius#include <iostream>using namespace std;double…
Q: def reverse_capitalized_substrings(s: str) -> str: """ Given a string , we define a capitalized…
A:
Q: Q3 OCaml type signature 1 Point The OCaml type signature val f : 'a ->'a = indicates that function…
A: 3. The answer to this question is true.
Q: Complete the function stricmp which works like strcmp but compares strings without regard to case.…
A: cpp code- #include<iostream>#include <string.h>#include <algorithm>using namespace…
Q: size) and argv (an array of pointers to C-string). It will determine whether it has the argument of…
A: In this question, we are asked to write a function and pass it argc and argv Explained each line of…
Q: calculate the least common multiple by calling the gcd() function
A: we know that, gcd * lcm = product of two number using this we will solve the question.
Q: remove_substring_from_string(s, substr): This function takes two strings s and substr as input. It…
A: PROGRAM CODE: # start definition of function to remove substringdef remove_substring_from_string(s,…
Q: Write the_code for the function printRoster, it should print out the contacts in a format similar to…
A: 1. Run loop for each pair in roster i. print the key and end line. ii. run loop for…
Q: I have been having trouble with this assignment. Attached will ben the assignment guide lines and my…
A: compilation failed
Q: I need a function that takes a string and returns initials such as Bob Burnett becoming B.B. string…
A: A C++ program takes the phrase as input and displays its acronym. the acronym is an abbreviated word…
Q: Define the function number_in_trophic_class(tli3_values, classification) which takes a list of…
A: In this problem, we need to design the code in the Python programming language. Input - trophic…
Q: in C++ make sure input for entering phone # is availible Given a long long integer representing a…
A: Start.Define a struct named StructuredPhoneNumber to represent phone numbers with area code, prefix,…
Q: python question Define a function named filter_list with three parameters: the 1st parameter,…
A: PROGRAM EXPLANATION Define a function filter list as given in the question. This function will…
Q: (1) Define function second that receives a list and returns the second element, in the following…
A: Problem statement: a) use !! infix operator b) use head and tail function See below steps for…
Q: Write the function readSalesData. #include #include #include #include #include using…
A: check further steps for the answer :
Q: This program goes where no program has gone before, exploring new frontiers in C++. The program…
A: Step 1: Create header file Planet.h to contain the structure declaration for Planet. Create header…
Q: Word Count Problem Consider that you have been hired to design in C++ the program that will count…
A: Given:
Q: Program Specifications Write a function called rCopy that copies the entire contents of one file to…
A: I have designed and developed the program for the given question Assuming that it is to be written…
Q: Define a Python function named expensive_counties that has two parameters. The first parameter is a…
A: def expensive_counties(txt_file, csv_file): #creating an empty dict to store the results…
Q: Problem statement def stringMatch(subStr,strLine): """ This function returns the index…
A: Programming Language: Python def stringMatch(subStr,strLine): if subStr in strLine: #checking…
Q: In C++, Write a function named that accepts argc and args with the same data type as command line…
A: Answer: C++ Source Code: #include<iostream> int size(char * arg){ int i=0; while (arg[i] != 0)…
Q: 2. are_anagrams This function takes two strings and returns True if they are anagrams of one…
A: 1. create two empty strings 2. iterate over the first string 2.1 if the current character is a…
Q: 4. pet_shopping_list For the purposes of this question, if you have a pet of a certain type, that…
A: 1) Below is Program that define a function pet_shopping_list takes a pet name as input and return a…
Q: g a string into two parts based on a delimiter has applications. For example, given an email…
A: Breaking a string into two parts based on a delimiter has applications. For example, given an email…
Q: main.cpp: In function ‘int main()’: main.cpp:32:25: error: expected type-specifier before…
A: See the following code and check now
Q: . pet_shopping_list For the purposes of this question, if you have a pet of a certain type, that…
A: PYTHON CODE: def pet_shopping_list(pet):if pet == 'mice':pet_list = ['mouse food', 'mouse treats',…
Q: C++ question Question 2: syllable count Problem statement In English, a syllableLinks to an…
A: Initialize a count variable to 0, and a boolean variable prev_vowel to false. Loop through each…
Q: string ToUpper(const string& phrase){ string retVal phrase; for (size_t i = 1; i < phrase.length();…
A: Please find the answer below :
Q: Complete the zero_extend_number() function that takes two parameters: • The integer parameter number…
A: Procedure followed in def zero_extend_number(number,length) : Declare variable len_num and…
Q: n c++ i have this struct struct Student { string firstName, lastName; int pointTotal;…
A: The question is to write C++ code in respect to the given condition.
Q: Introduction In this lab, you are writing a function slashes_to_written(date_list) that gets the…
A: def slashes_to_written(date_list): month_names = { 1: "January", 2: "February", 3: "March", 4:…
Q: operations using the C++ programming language
A: code is given below:--- #include<iostream>#include<fstream>using namespace std;int…
Q: Q# Describe what a data structure is for a char**? (e.g. char** argv) Group of answer choices A. It…
A: char is used to represent character and * is to represent a pointer
Q: C++ Given code is #pragma once #include #include "ourvector.h" using namespace std; ourvector…
A: Answer: I have complete function as in given question.
Q: Question 1: break phrase Problem statement Breaking a string into two parts based on a delimiter has…
A: The C++ code is given below with output screenshot
Q: 1. {w E {0, 1} *: w begins with 1 and, when interpreted as a binary number, is a multiple of 5}…
A:
Q: Problem DNA: Subsequence marking A common task in dealing with DNA sequences is searching for…
A: Given The answer is given below.
Q: C++ code please: Create a generic function print_if(start, stop, condition, out) that prints to…
A: The C++ code is given below with output screenshot
Q: Define the function lake_to_tli3_dict(readings) that takes a list of (lake_name, chla, tn, tp)…
A: Python which refers to the object oriented programming languages. Python which refers to the high…
Q: A faro shuffle involves splitting a deck of cards into two piles, then taking cards exactly…
A: import itertools,random deck =…
Q: Which of the following statements is NOT correct? Group of answer choices C++ language provides a…
A: C++ is widely used in a variety of domains, including system programming, game development, desktop…
Q: Erlang File -module(exam). -compile(export_all). -include_lib("eunit/include/eunit.hrl").…
A: Answer: I have done code and also I have attached code as well as code screenshot.
Q: Implement the following: 1) Define a function evenList() with an arbitrary parameter a. 2) This…
A: Python program to print the even numbers
Step by step
Solved in 3 steps
- C++ please Write a driver function definition called add that takes as its parameters two FractionType objects. The driver function should add two fractions together and return a FractionType object. Remember that the denominators of fractions cannot be 0. (Hint: validate each fraction before performing the addition operation. Also, do not to reduce the FractionType object to its simplest form.)Write in c language please: write a statement that calls the function IncreaseItemQty with parameters computerInfo and addStock. Assign computerInfo with the returned value. #include <stdio.h> typedef struct ProductInfo_struct { char itemName[50]; int itemQty;} ProductInfo; ProductInfo IncreaseItemQty(ProductInfo productToStock, int increaseValue) { productToStock.itemQty = productToStock.itemQty + increaseValue; return productToStock;} int main(void) { ProductInfo computerInfo; int addStock; scanf("%s", computerInfo.itemName); scanf("%d", &computerInfo.itemQty); scanf("%d", &addStock); /* Your code goes here */ printf("Name: %s, stock: %d\n", computerInfo.itemName, computerInfo.itemQty); return 0;} thank you in advance▾ Part 1: Sin Tax Syntax [NEW PROBLEM] Complete the function sin_tax, which computes and returns the total cost to purchase several items, some of which might be subject to sin taxes. The function takes three arguments: • items: a list of items to purchase (strings). If an item appears more than once, this means we want to buy it more than once. • prices! a dictionary that maps an item (string) to its price (float) • tax rates: a dictionary that maps an item (string) to its sin tax rate (float). The rate is given as a decimal (e.g., 0.08 to represent 8%). If an item from items does not appear in tax rates, then that item is not subject to a sin tax. Assume that every string in items is a valid key in prices. Example #1: items: ['beer', 'wine', 'cigarettes'] prices: {'beer': 18.95, 'cigarettes': 12, 'wine': 20.0} tax_rates: {'beer': 0.03, 'cigarettes': 0.1, wine': 0.05) Returned: 53.72 Example #2: ['wine', 'beer', 'wine', 'cigarettes', 'wine'] {'beer': 15.5, 'cigarettes': 13, 'soda':…
- Given: (3,6) int numi, num2, newNum; double x, y; Which of the following assignments are valid? If an assignment is not valid, state the reason. a. numl = 35; b.newNum = numl - num2; c.numl = 5;num2 = 2 + numl;numl = num2 I 3; d. numl * num2 = newNum; e.x = 12 * numl - 15.3; f.numl * 2 = newNum + num2; g. x / y = x * y; h. num2 = numl % 2.0; i.newNum = static_cast<int> (x) % 5; j.x = x + y - 5; k. newNum = numl + static_cast<int> (4.6/2);This is the code I have so far, just need help with the areas that say "***". #include <string> // for string processing#include <iostream> // Access input output stream: cin coutusing namespace std; // Access cout, endl, cin without using std:: as prefix// 8 global variables and 7 prototypes of functionsstring pw; // global pw for the password to be checkedbool r1, r2, r3, r4, r5, r6, r7; // global 7 boolean flags for violationsvoid s1(); void s2(); void s3(); void s4(); void s5();void s6(); void s7(); // 7 prototypes of functions to be defined after main() int main() // like a driver to call those 7 functions to check a password {// begin of main // must return integer to the callercout << "Welcome to the PASSWORD game designed by Joel!" << endl;cout << "Please enter a password:" << endl;getline(cin, pw); // pw may have blanks anywhere, so must use getline( )cout << "Your password \"" << pw << "\" " ;while (pw != "quit") // the…Part 3: Time for a Financial Checkup Complete the function financial_checkup, which takes a dictionary representing your monthly budget for certain categories of expenditures (budget), and a dictionary that represents how much you actually spent in each category (outlays). The function then creates and returns a new dictionary of those categories in which you overspent and the excess amount. Specifically, the returned dictionary maps the category name to the amount of excess spending, given as a negative number. If a category appears in outlays, but not budget, we interpret this to mean that we budgeted $0 for that category, so the entire amount in outlays is considered to be excess spending. Example #1: budget: spent returned: {'food' -95, 'travel': -100} Example #2: budget: spent {'food': 125, 'gas': 75, 'travel': 400} {'food' 220, 'gas': 10, 'travel': 500} Example #3: {'food' 100, 'gas': 30} {'food' 220, 'gas': 10, 'travel': 500} returned: {'food": -120, 'travel': -500} {'drinks'…
- C code blocks Implement a function which receives a character array and determines if the word is a palindrome or not. A palindrome is a string that is spelt the same way forwards and backwards (see the example below). The function should return 1 if the character array is a palindrome and 0 if it is not. Write the entire function in the space below. Your answer should not include the function prototype, the main function or any include statements. The function should not contain any printf statements. Define your function in the same way as the given function prototype. Function prototype: int palindrome(char a[]); For example: Input Result hello 0 radar 1 acca 1C++.Write a function, named SecondNegative, that takes a const reference to a vector of doubles, it should return an const_iterator to the element in the vector that is the second value that is negative. If no such element exists, have the iterator point to one past the end.Please read the C++ vectors to learn about vectors in C++ and to find the answer to this question. Match the member functions of vectors on left with the correct description on right. Hint: Please follow the exact wording in the read. erase emplace_back capacity assign empty Search [Choose ] Choose] Return size of allocated storage capacity Returns the number of elements in the vector. Construct and insert element at the end Removes from the vector either a single element (position) or a range of elements ([first, last)). Removes all elements from the vector (which are destroyed), leaving the container with a size of 0. Assigns new contents to the vector, replacing its current contents, and modifying its size accordingly. Returns whether the vector is empty (i.e. whether its size is O). [Choose ] [Choose ] 2
- Function 3: Positive Unique Numbers _missingSpace(string) Create a JavaScript Arrow function that meets the following requirements: • Authored using arrow expression syntax (constant name _missingSpace) • The function is passed a string argument • The function inserts a white space between every instance of a lowercase character followed immediately by an uppercase character, and returns the modified string, with whitespaces, back to the caller. • Console log output is NOT permitted.9. Complete the function prototype so that the callback parameter accepts a closure. The closure accepts a String and an Int parameter but does not return anything. func send(to: String, data: String, callback: _____ ) { // function body }