hello, i am having problems with this hw question, Explain the problem with the following code: int a[] = {1, 2, 3, 4, 5}; a[5] = 10; cout << a[5] << endl;
Q: Study the definition of function funny and answer the question below. void funny (int &vall, int…
A: In the given program code we call the function funny and pass the value as a reference (address of…
Q: Study the definition of function funny and answer the question below void funny (int &vall, int…
A: output is 42 X[2]=4 and X[4]=2 since there is no new line in code so output will be 42
Q: Write a function named “HasDashDashOnBothEnds” that accepts 2 parameters of the same as command line…
A: #include <iostream>using namespace std; bool HasDashDashOnBothEnds(int count, char**…
Q: Write a program that initialize an array of pointers with some DNA sequences. Create a non returning…
A: A C program for the given criteria is as follows, File name: “main.c” #include <stdio.h> //…
Q: Question 4 We consider the the following code: #include using namespace std; void add(int i, int…
A: Here in main() function A=1 B=2 C=3 D=1.1 We call add(A,B); => add(1,2) void add(int i,int…
Q: A common programming problem is maintaining a list in numerical or alphabetical order. For example,…
A: Data structure: The data structure is one of the major concepts of computer science. Each and every…
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: This is the code so far #include // for cin and cout #include // for setw() and setfill() using…
A: Output :-
Q: Write a program that stores first n prime numbers in a two-dimensional integer array. You should ask…
A: #include <iostream>using namespace std; int isPrimeNumber(int n){ if(n==2) //if…
Q: Write a complete one C++ program that performs the following tasks: a. A user-defined function to…
A: Code: #include<iostream> #include<string> using namespace std; //Function returns last…
Q: Why does little-endian vs. big-endian matter here in this code
A: *In case of multiple questions, only the first will be answered. For other questions, put separate…
Q: Q6: Write a program in C++ that contains overloaded functions with name OvOperation(). When the main…
A: Required: C++ program to demonstrate function overloading. Required code with comments for…
Q: Computer Science In C++ use the following STL algorithms: reverse, rotate, and shuffle. Write…
A: #include <algorithm>#include <iostream>#include <vector>using namespace std; int…
Q: a. Write a function to implement the dot product of two arrays a and b, both with the same length…
A: NOTE: As per Bartleby guidelines for multipart question. We have to answer only first 3 subparts.…
Q: Question 17 Study the definition of function funArray and'answer the question below. void funArray…
A: Let's first understand the given code: double array X[] is {1,3,5,7,9,11} which starts from index-0.…
Q: I have a question about programming in C(89) C. Could someone please show me how to make a program…
A: The ask is to write a C program to: - take user input for an array size - take user input for each…
Q: Code below is of tic tac toe game in C. With 2d array. But it is between player 1 and player 2. I…
A: Given that Code below is of tic tac toe game in C. With 2d array. But it is between player 1 and…
Q: Code below is of tic tac toe game in C. With 2d array. But it is between player 1 and player 2. I…
A: I have mentioned full code in 2 part which includes tic tac toe game between the person and…
Q: a- Consider the following program written in C syntax: void swap(int a, int b) { int temp; temp = a;…
A: Actually, function is a set of statements.
Q: Suppose that you have the following function definition. int find(int x, int y){return (x + y - x *…
A: (a) The function call u = find (list1[0], v); is valid. Explanation: An integer arrays list1[0] and…
Q: Complete it. #include using namespace std; bool isThere(string s, char c, int si, int ei){…
A: Complete the given C++ program. Basic Information About the given program: In the given program we…
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: Part 2: Combine arrays Write a program that does the following: Creates int array array_1 of length…
A: Note as per BNED rules we are allowed to answer 1 question at a time if you want a response of the…
Q: Code for this in C: You have created three arrays: array A of size 100 array B of size 50 array C…
A: logic:- for(int i=0;i<100;i++) { A[i]=(i+1); } j=1; for(int i=0;i<50;) {…
Q: Please write a full code in JAVA for this: A function foo has k integers as input arguments,…
A: #include #include #include #include 57 /* concatenate n copies of src into dest */ /* returns dest…
Q: Allow the user to enter multiple pairs of x and y coordinates on a 2 dimensional graph (these…
A: #include<stdio.h>#include<math.h> //the structure that holds a particular pointstruct…
Q: (Algebra: solve quadratic equations) The two roots of a quadratic equation ax? + bx + x = 0 can be…
A: Sample Response: //C++ program to find roots of a quadratic…
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: Python only Rajesh loves lucky numbers. Everyone knows that lucky numbers are positive integers…
A: m,c,k = [0]*(10**5+1),[0]*(12000),0 m[1],c[0] = 1,1 for i in range(2,10**5+1): j = i while j…
Q: How do you use smart pointers when trying to call a library function that was written before smart…
A: ALGORITHM: In Employee class first, declare a parameterized constructor. In print function call ep…
Q: make v point to pointer t. That is: int *v = &*t; printf("%d\n", *v);
A: & is address operator , * is pointer operator also known as dereferencing operator. A pointer…
Q: Consider the following function main: Int main() { int inStock[10][4]; int alpha [20]; int beta[20];…
A: Given question has asked to write following function on given array, inStock[10][4], alpha [20],…
Q: correct way to assign the pointer p to the address of x
A: Introduction to the concept of the pointer: Pointers are the symbolic representation of the…
Q: swap the value of 5.34 to 2.0
A: Code: #include <stdio.h>#include <stdlib.h> int main(){ char c_1920213 = 'A'; char…
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: Study the definition of function funny and answer the question below. void funny (int &vall, int…
A: In the given function definition, The name of the function is funny. This function takes two…
Q: Write C++ Program to determine the max numbers between 2 arrays. For example: 3 18 34 7 2 |0 |11|20…
A: Algorithm : inputNumbers function Step 1 : declaring required variables and temp array. Step 2 :…
Q: C language) Write a function intersect() that takes five arguments: an array of integers, number of…
A: Program Plan:- Ask the user to enter the size of the two arrays along with their elements. Declare…
Q: Look at the following C++ code and comment each line about how it works with pointer. int i = 33;…
A: CODE WITH COMMENTS AS PER THE QUESTION: int i = 33; //defining integer variable i having 33…
Q: Write a function Littlest3(values) that takes a list of numbers values and returns a list of the 3…
A: Kindly Note: As per our guidelines we are supposed to answer only one question. Kindly repost other…
Q: def find_root4(x, epsilon): ''' IN PYTHON Assume: x, epsilon are floating point numbers and epsilon…
A: Answer: Python Source Code: def find_root4(x,epsilon): a = 0 b = max(1.0,x) y = (b+a)/2.0…
Q: Input Set A : 1, 2, 3, 4 Input Set B: 2, 4, 6, 8 Input Relations: {(1, 1), (1, 2), (2, 1), (2, 2),…
A: #include <bits/stdc++.h> using namespace std; int main(){ set<int> s1,s2; int…
Q: A common programming problem is maintaining a list in numerical or alphabetical order. For example,…
A: Actually, program is a executable software that runs on a computer.
Q: Write a code in C++ / cpp to solve the following problem In a hypothetical island, one can buy land…
A: Approach: Follow the steps to solve the problem: •Check if the given N contains digit D or not. If…
Q: For this exercise, write a function that inserts a three-digit part number in a list of part…
A: package Java.C.c; import java.util.*; import java.lang.*; import java.io.*; class value {…
Q: Assume that: int x[5] = {2,4,5,7,8}; What are the values of x after calling: swap(x+2, x+4);…
A: initial x[5]={2,4,5,7,8} x[0]=2 x[1]=4 x[2]=5 x[3]=7 x[4]=8
Q: The topic is Booth's algorithm - Explain this C programming code - i have a seminar. //header files…
A: Booth's Multiplication Algorithm: Booth’s algorithm is a multiplication set of rules that multiplies…
hello, i am having problems with this hw question,
Explain the problem with the following code:
int a[] = {1, 2, 3, 4, 5};
a[5] = 10;
cout << a[5] << endl;
Step by step
Solved in 2 steps with 1 images
- Please Help In JAVA Here is the skeleton of a code for insertion sorting in a functional language. You have to add right lines of codes for the language you choose (C, C++, C#, JAVA etc,). The following sample is for C++ (define (insert L M) (if (null? L) M (if (null? M) L (if (< (car L) (car M)) (cons (car L) (insert (cdr L) M)) (cons (car M) (insert (cdr M) L)))))) ;; Exp. (insertionsort '(4 2 10 3 -1 5)) ==> (-1 2 3 4 5 10)(define (insertionsort L) (if (null? L) '() (insert (list (car L)) (insertionsort (cdr L))))) (define (random-list n) (unless (exact-nonnegative-integer? n) (raise-argument-error 'make-list "exact-nonnegative-integer?" 0 n)) (let loop ([n n] [r '()]) (if (zero? n) r (loop (sub1 n) (cons (random 2147483647) r))))) Sample function call:(insertionsort (random-list 10000)) Hint: most languages have some function to determine the runtime of functionstemplate specialization question Create a template specialization to test for string and pointers-to-char string s = plus("he", "llo"); const char* sl = "aaa"; const char* s2 = "bbb"; char* s3 = plus(sl, s2) // is char* s3 not const char* s3The famous Sudoko game is played on a grid of 9 ×9. Each empty square in this grid has to befilled with a number from 1 – 9 without repeating any numbers within the row and column of thesquare. We will implement a program in C to help us solve a simple 4 ×4 Sudoko puzzle. We willinvestigate a 4 ×4 Sudoko puzzle, where each row or column is missing 2 numbers only. To fill ina square, if you scan the row (or column) of the square, you will eliminate two out of 4 numbers,and if you then scan the column (or row) of the square, you will eliminate one more number. Thus,you will be left with one missing number in the row and column of the empty square. Thus, youneed to fill in the square with this missing number. We are NOT studying the case where scanningthe row and column of a square eliminates only 2 numbers.For example, in the following grid, row 0 and column 0 is empty. If we scan row 0, we can eliminate3 and 4 since they are already there in the row. And if we scan the column, we can…
- MUST BE DONE IN C - Allow the user to enter multiple pairs of x and y coordinates on a 2 dimensional graph (these numbers may be considered unitless) along with a text label for that set of points. You must use a "struct" data type to define how these are stored. - The x and y coordinates should be type "float" or "double" - Allow multiple data points to be entered by the user, so the first thing the user must ask is how many coordinates will be entered. Since multiple entries will be made you must create an array of that "struct" type. - Once all of the coordinates and labels are entered, calculate the distance between each set of points (you DO NOT have to store all of the distances!!!). In this lab you may use "math.h" (it may be useful). - Determine which coordinates are closest to each other out of all of the pairs. - Determine which coordinates are furthest from each other out of all of the pairs. NOTE!!!! There will be a 10 point value for efficiency. Please contemplate the BEST…Describe what problem occurs in the following code. What modifications should be made to it to eliminate the problem? int[] sums = {6, 12, 3, 32, 12, 10, 9, 6}; for (int index = 1; index <= sums.length; index += 1) { System.out.println(sums[index]); }What is the correct way to assign the pointer p to the address of x?. Single choice. p = %x; p = &x; &p = *x; *p = &x;
- Create a template specialization to test for string and pointers-to-char string s = plus("he", "llo"); const char* sl = "aaa"; const char* s2 = "bbb"; char* s3 = plus(sl, s2);Write a function in C++ which (normally) allocates new space for a double array. It should alter its pointer argument to point to the newly allocated space. The size of the array should be a second argument. If this argument is not a valid array size, allocate a single double instead of an array. An example call might be: double * p; allocate(p, 25); // p now points to an array of 25 doubles -- if successfulIf a pointer is not pointing anywhere, it’s recommended you have it point to nothing. This is accomplished using NULL in C, as with int *p = NULL Why do you think that is a good idea? Explain your answer.
- Problem 8. What is the correct syntax of declaring array of pointers of integers of size 10 in C++? a) int arr = new int[10]; b) int **arr = new int*[10]; c) int *arr = new int[10]; d) int *arr = new int*[10];I know how set and function works ... but i just dont know how do i implement it on a C++ program.. here is the question that i have problem with a) User need add input for set A, B and Relation b) Add at least 2 operation of sets such as intersection, union, and etc. c) Add at least 2 operation of function such as transistive, symetric and etc. d) Write a program that able to pick any one of four options(TWO operation of set and TWO operation of relation) example of the outputI need to complete this table, JAVA. Assuming an unsorted Map starting with no contents, describe the return values and contents of the map (initial values on the left) after the operation, when done in order. Also Assume entries are in (key,value) format. The first three function calls are completed. FUNCTION CONTENTS RETURN VALUE isEmpty() {} true put(5,X) {(5,X)} null put(7,F) {(5,X),(7,F) null put(2,C) put(8,D) put(2,E) get(7) put(7,Y) get(4) put(4,X) get(4) size() remove(5) isEmpty() size()