void swap C, { int tmp = v2; v2 = v1; v1 = tmp; int main() { int i = 10; int j cout << "Before swap() " << i « ":" «j
Q: Write a function 'morseCode' that takes an array containing a series of either 'dot' or 'dash'…
A: The program is written in JavaScript. Check the program screenshot for the correct indentation.…
Q: A function foo) is declared as follows: int foo (int a, int b); Write an assembly function…
A: An assembly language is a low-level programming language designed for a specific type of processor.…
Q: Computer Engineering In multiplication, assume that leading zeroes are not allowed. Write a program…
A: Given: In multiplication, assume that leading zeroes are not allowed. Write a program in C++ to help…
Q: In C In C, strings are implemented by a contiguous sequence of characters, terminated by NUL…
A: A. A. Write your own version of stropy that receives two character pointers and copies the…
Q: Based on the above program, create a function void priorityQueue (queue q), whi accept current queue…
A: Answer:
Q: fill in the blank int x = 20 ; char buf [ 10 ] ; ssprinf ( ________ , "%d", _______ ) ;…
A: Given: Fill in blanks
Q: Write a c++ program: NOTE: Pointers must be used to solve the following problem. Write a function…
A: Pointer: The pointer variable stores the address of a variable or points to the address of another…
Q: function myCompose(f,g){// TODO: return (f o g);// that is, a function that returns f(g(x))…
A:
Q: strings. It's actually such a common task that modern distributions of the Linux operating system…
A: Sample Screenshot:
Q: write a function that gets 3 pointers int* a, int* b, int* c, and rotates the values in their…
A: note that a gets the value of b and we are working on pointers here so a will loose its originality.…
Q: Write one function du(a,b) which returns a list of a b times (b>=0). Must use identical function…
A: Here function defintion is given , du(a,b) So here is the code given below with proper comments:…
Q: c programming Write a function f which takes three pointers to int variables (a, b, c). Then it…
A: #include<stdio.h>int max(int a,int b,int c){ // compute maximum of 3 numbers return…
Q: 305. A program that runs in parts on several computers is said to be a. delegated b. spread c.…
A: Recursive means calling itself so, this is not correct
Q: With the code below,dynamic memory allocation is not utilized at the main function. Rewrite the main…
A:
Q: This program demonstrates the use of pointers. What is the output of this program? Assume we know…
A: CODE:- #include <iostream> using namespace std; int main() { int x=25; int *ptr; // pointer…
Q: /** • PROBLEM 3: The following function draws miskey mouse, if you call it like * this from main: *…
A: the answer is given below:-
Q: ere function f returns the results through address passing. Assuming c is a global complex number…
A: Complex increase is a more troublesome activity to comprehend from either an arithmetical or a…
Q: CodeWorkout XZ65: Recursion Programming Exercise: GCD The greatest common divisor (GCD) for a pair…
A: Below is the recursive function to find GCD:
Q: A pointer int *p is declared, it is able to hold addresses of double type values as well.. Single…
A: A pointer int *p is declared, it can not hold addresses of double type values as well.
Q: Question (see uploaded pic): Given Code (Python): def binary_to_decimal_1(str, n): #Base…
A: Algorithm: Start Read a binary string Implement a recursive method binary_to_decimal_1() which…
Q: C++ write a program that reads a matrix of real values where the number of lines and the number of…
A: Program plan:- Main function. Declaring the matrix. Declaring the variables. Taking input from the…
Q: In C programming language, choose True or False for the following statem Each question is 2 point.…
A: fscanf function returns a NULL pointer f end-of-file is reached Answer: True. A function which…
Q: C++ By defining a dynamic allocation for pointer array, ask the user to enter some numbers and then…
A: Solution - What is a Dynamic Array? A dynamic array is quite similar to a regular array, but its…
Q: Given the following function f, what will be the output of the function call f(3)? int f(int n){…
A: The problem contains 2 questions where : First question is related to calling a method and finding…
Q: #in c++ We need to store information about each student in a class of N students. For example, name,…
A: PROGRAM EXPLANATION: The algorithm for creating the program with given description is as follows:…
Q: Write the reccurence relation for the following function (in C-style code) void T(n){ if(n>1){…
A: The given code is as follows: void T(n){ if(n>1){ int j; for(j = n;…
Q: Q1 Assume that int x[5] = (5,4,3,2,1}; What are the values of x after calling Swap(x+1, х+4); Swap…
A: swap(int *pa, int *pb) { int t; t = *pb; *pb = *pa; pa=&t; } this function takes…
Q: Computer Science A restaurant requires WAIT ADT to help waiter to wait tables. The application is…
A: #include<iostream>#include<string>//#include<Windows>using namespace std; class…
Q: odular Programming: Your program should be modular and consists of the following functions: a)…
A: the code is an given below "
Q: 3. Smart Numbers language C++ G autocomplete.ready O 1 > #include A number is called a smart number…
A: C++ Code #include <bits/stdc++.h>using namespace std; bool subset(int arr[], int n, int…
Q: Consider the following segment of code:procedure Mvar x: integer;procedure A (c: integer)var a, b:…
A: Instructions for drawing the runtime stack (at “a:= c-d;”):The stack includes the activation records…
Q: Draw the code diagrams with labels for statements and branches
A: Solution a) Here I've drawn the code diagram with statements and branches for the given code.…
Q: Code Example 4-2 def get_volume (width, height, length=2): volume = width * height * length def main…
A: The correct solution is given below with an explanation
Q: Show the runtime stack and activations for the following recursive function. public static void…
A: Runtime stack and activations for the following recursive function
Q: Write code for circular queues method (Deque) using array data structure which should: Delete the…
A: Sample Response: //C++ program to delete values from the circular queue using array…
Q: void add(int *ptr1, int *ptr2, int *val) { *ptr1 += *val; *ptr2 += *val; }
A: #include <stdio.h> void add(int *ptr1, int *ptr2, int *val); // defination of add function…
Q: A restaurant requires WAIT ADT to help waiter to wait tables. The application is required to…
A: Given: A restaurant requires WAIT ADT to help waiter to wait tables. The application is required to…
Q: Lets the user enter courses and prints them out correctly at the end Catches there being six courses…
A: Program is very easy to construct here is the approach First create the empty list and create the…
Q: 2. Write a C program which implements the matrix multiplication process. To multiply two matrices,…
A: Screenshot of the C program is as follows:-
Q: Question (see uploaded pic): Given Code (Python): def binary_to_decimal_1(str, n): #Base…
A: According to the Question below the Solution: Output:
Q: ET-580 Object-Oriented Progzanning. 5. rowbridge 2020 b) Create a function that returns the count…
A: In the main method – Declare a variable to input the number. Take a number as an input. Call the…
Q: 7.10: Tic Tac Toe (sort of). (c++) Write a program that will allow two users to play tic-tac-toe.…
A: The code is written below in c++ language- #include <iostream> #include <stdlib.h>…
Q: Using C not (C++ or C#) Write a function int IsIncreasingOrder(int A[], int n) which will return 1…
A: I give the code as per your requirement along with output and code screenshot in C
Q: For this code, just explain the void pop function, with each and every line. And please provide…
A: POP function:- Basically POP function created to remove the top elements l from the stack.
Q: Write a C++ program using C-STRINGS. Each function deals with null terminated C-strings. You can…
A: Since the program contains multiple sub-parts, we will answer only first three sub-parts. If you…
Q: 11.11 LAB: Number pattern Write a recursive function called PrintNumPattern() to output the…
A: Actually, programming is an executable software that runs on a computer.
Q: task7.c Compare 2 strings function cmp will print out > if s1 is "bigger" than s2, #include void…
A: We can use int asc = (int)'a'; to convert char to ascii values. count1 and count2 shound be used to…
Q: Create a function append(v1, v2) that adds a copy of all the elements of vector v1 to the end of…
A: Solution:
Q: Question no. 1
A: c++ code: #include <iostream>#include <iomanip> using namespace std; double…
Q: the file Ackermann.cpp. Inside the file the recursive Ackermann function is implemented (described…
A: It is defined as a direct descendant of C programming language with additional features such as type…
Which function parameter list could make the
Trending now
This is a popular solution!
Step by step
Solved in 2 steps with 1 images
- IN HASKELL PROGRAMMING LANGUAGE PLEASE In case you do not know it: the game is played on a 3x3 grid that is initially empty. Two players are playing, by alternatingly making moves. A move by a player places their token (an X for player 1, an O for player 2) into a cell that was empty. We are using algebraic notations for indexing the positions in the board, with A,B,C indexing the columns and 1,2,3 the rows. Specifically, these coordinates would be used in the implementation for moves made by a human player. If the X X O Figure 1: Sample board position same token appears 3 times in any of the three columns, three rows or two main diagonals the game is over and that player wins. If the grid is filled without that happening the game is a draw. For the depicted board, we have Xs in positions C3 and A2, and an O in position B1. It would be O’s turn to make a move; a legal move would be C2, but it is not a good move, because X can force a win by responding A1. O cannot force a win, but…in C for STM32F446RE microcontroller Write a source library that contains the with the following public functions: void keypadInit(void); /Initiallized the GPIO to read the keypad. uint16_t readKeypad(void); //Returns the state of all of the keypad buttons in the return value at the moment the function is called. void decodeKeypad(uint16_t, char *); //Takes the state of the keypad and returns (by reference) an array of the key's pressed. The library should work with the following main: int main (void) { uint16_t key; char carray[17]; keypadInit(); while(1) { while(!(key = readKeypad())); /*Get which keys pressed*/ decodeKeypad(key, carray); /*What are those keys*/ printf("%s\n",carray); /*Print those keys to screen*/ while(readKeypad() == key); /*Wait for the keypad to change*/ }} Problem 1: Write a library that works with the following pin assignments R0 -> PC0 R1 -> PC2 R2-> PC4 R3 ->…Language: JAVA Script Your company is giving every employee earning less than $50,000 a 10% raise! *Write a function 'employeeRaises(peopleObj)' that takes an array of objects s containing employee names and their salaries and returns an array containing the employees that need raises, along with their new salaries. Example: employees [ {name: "Alice", salary: 80000}, {name: "Bob", salary: 48000 }, {name: "Carol", salary: 60000}, {name: "Dan", salary: 78000}, {name: "Ellen", salary: 100000}, console.log(employeeRaises (employees) ); // [ { name: 'Bob', salary: 44000 } ] funcation emplyeeRaises(employees){ |// Your code here} /****DO NOT MODIFY ANYTHING UNDER THIS LINE****/ try{| module.exports = employeeRaises;}catch (e) {|module.exports=null;}
- C++ Dynamic Programs Hoskins College offers both curriculum and continuing education courses. Write a program that dynamically tracks these courses using an array of object pointers. Every course (both curriculum and continuing education) has a course id, title, room number, and number of contact hours. A curriculum course has credit hours and tuition rate. Tuition is calculated by multiplying the course's credit hours by tuition rate. A continuing education course has a flat fee (cost). Implement a show() function in every class that displays the data in the object. Part A: Create an inheritance-based collection of classes to represent these different courses. Include code in main to test your work by instantiating objects of the two derived classes. Part B: Modify your program. Remove the objects you created in main to test the classes. Modify the base class so that show() becomes a virtual class. In main, create a single array capable of holding pointers to objects of both…Topical Information Use C++. This lab will help you practice with dynamic memory (NOT mixed with classes). Program Information Heat flow through a rod can be simulated fairly easily in a computer program. We can simulate the rod using an array of temperatures. The rod begins all at the same temperature (user determined), but holding some position(s) of the rod at constant temperature (holding a match or ice cube to the rod) provides a [set of] heat source(s) (or sink(s)). To update the temperature at each time step (second?), you take the average of the positions on each side from the previous time step (and at the current position). For instance, if the following was the initial state of the rod: +------+------+------+------+------+------+------+------+ | 10 | 10 | 10 | 10 | 10 | 10 | 10 | 10 | +------+------+------+------+------+------+------+------+ And then the user specifies that there is a heat source at the left end of 100 degrees:…In java Develop a function that accepts an array and returns true if the array contains any duplicate values or false if none of the values are repeated. Develop a function that returns true if the elements are in decreasing order and false otherwise. A “peak” is a value in an array that is preceded and followed by a strictly lower value. For example, in the array {2, 12, 9, 8, 5, 7, 3, 9} the values 12 and 7 are peaks. Develop a function that returns the number of peaks in an array of integers. Note that the first element does not have a preceding element and the last element is not followed by anything, so neither the first nor last elements can be peaks. Develop a function that finds the starting index of the longest subsequence of values that is strictly increasing. For example, given the array {12, 3, 7, 5, 9, 8, 1, 4, 6}, the function would return 6, since the subsequence {1, 4, 6} is the longest that is strictly increasing. Develop a function that takes a string…
- Java - Gift Exchange *** Please include UML Diagram and notes in code Minimum requirements are: At least 1 loop An Array or ArrayList At least 3 Java classes Use methods I am trying to make it so that the program will: Prompt for the number of people included in exchange - If not even it will state that there has to be an even number and ask for the number of people included again (loops). Prompt to enter a participant's first name Prompt for the participant's age Print out the random matching of participants so that everyone gets a gift and everyone gives a gift. Please include UML DiagramA binary operator is an operation that is performed on two operands. For example, addition is a binary operator that adds two operands (e.g., 2 + 4). In the provided UML diagram, all binary operators have two operands and an execute method that performs the appropriate operation on the operands. The AddOperation class should add the two operands. The SubtractOperation class should subtract the two operands. Here is an example of how a binary operator could be used: IBinaryOperator operator = new AddOperator(8, 12);System.out.println(operator.execute()); // should print 20operator.setLeftOperand(18);System.out.println(operation.execute()); // should print 30 crate a Main.java to test your codeplease code in python Forbidden concepts: arrays/lists (data structures), recursion, custom classes You have been asked to take a small icon that appears on the screen of a smart telephone and scale it up so it looks bigger on a regular computer screen.The icon will be encoded as characters (x and *) in a 3 x 3 grid as follows: (refer image1 ) Write a program that accepts a positive integer scaling factor and outputs the scaled icon. A scaling factor of k means that each character is replaced by a k X k grid consisting only of that character. Input Specification:The input will be an integer such that 0 < k ≤ 10. Output Specification:The output will be 3k lines, which represent each individual line scaled by a factor of k and repeated k times. A line is scaled by a factor of k by replacing each character in the line with k copies of the character. [refer image2]
- C++ Using Card and Deck class created during the lecture or your own implementation that follows the spec for a card and deck, implement the following game: game is designed for a single player who is playing against the computeryou draw three cards for each player (player and a computer) Using the compare function from the Card class you compare each pair drawnIf the player's card is higher, the player gets a pointYou repeat this comparison 3 times (for each pair of cards you draw)The player wins if he gets more points than a computer (has more higher cards than the computer)In java there must be at least two calls to the function with different arguments and the output must clearly show the task being performed. (ONLY ARRAYS or ARRAYLIST) Develop a function that accepts an array and returns true if the array contains any duplicate values or false if none of the values are repeated. Develop a function that returns true if the elements are in decreasing order and false otherwise. A “peak” is a value in an array that is preceded and followed by a strictly lower value. For example, in the array {2, 12, 9, 8, 5, 7, 3, 9} the values 12 and 7 are peaks. Develop a function that returns the number of peaks in an array of integers. Note that the first element does not have a preceding element and the last element is not followed by anything, so neither the first nor last elements can be peaks. Develop a function that finds the starting index of the longest subsequence of values that is strictly increasing. For example, given the array {12, 3, 7, 5, 9, 8,…In C In this problem, you will recreate one of the truly great moments in history, namely the classic race of the tortoise and the hare. You will use random number generation to develop a simulation of this memorable event and use pointers to store / track the position of the two race contestants. Our contenders begin the race at “square 1” of 70 squares. Each square represents a possible position along the race course. The finish line is at square 70. The first contender to reach or pass square 70 is rewarded with a pail of fresh carrots and lettuce. The course weaves its way up the side of a slippery mountain, so occasionally the contenders lose ground. There is a clock that ticks once per second. With each tick of the clock, your program should adjust the position of the animals according to the rules shown in the table below. Implement the “race course” as an integer array containing the numbers from 1 to 70. Implement the positions of the tortoise and the hare as pointers,…