5 - a) 2 4 5 3 3 c) 6 12 15 9 int arr[4]= {2, 4, 5, 3}; for (int i= 0; i<4; i++) cout<
Q: in c language !! typedef struct { long restaurant_id; char restaurant_name[10]; char…
A: Give that write C typedef struct {long restaurant_id;char restaurant_name[10];char…
Q: # includeusing namespace std; int main (){int m[7]= {10, 1, 1, 111, 1, 13};int i ;coutusing…
A: We can initialise array and fix the elements or elements can be inserted by user at execution In…
Q: #include using namespace std; #define numVl 3 struct thNde { thNde* parent; int…
A: The code is written in C++ but instead of cout used printf for printing the outputs in code. Some…
Q: #include #include //user-defined functions question! using namespace std; struct Books { char…
A: Here is the c++ code.
Q: Question 1 Blank 1 Blank 2 Blank 3 What will be printed after executing the following C++ code? int…
A: Here, the content of array tt is subtracted from array dd, and stored in array rst. The order is…
Q: omputer Science Perl Questions Explain what this code is doing: “if(/[a-z]/) { print; } else {…
A: Answer:
Q: 3, Consider the code #define row 3 #define col 4 main) int z[row][col] {1,2,3,4,5,6,7,8,9,10,11,12};…
A:
Q: a) 10 5 c) 10 5 7 9 int arr[4]= {10, 5, 7, 9}; for (int i- 0; i<2; i++) cout<<arr[i]<< " *; b) 10 5…
A: Given: Required: Output of the codes given above
Q: + Exer
A: Note:- Answering the first 3 sub-parts as per the Guidelines: Errors are defined here: 48) The…
Q: Code: #include using namespace std; void BUBBLE(int A[],int N){ for(int k=0;kA[ptr+1]){…
A: Explanation: To remove the function from the program and writing everything into a main function is…
Q: include using namespace std; aclass om { public: void set (int x,int y) cout<<"The sum =" <<x+y<<…
A: Constructor: In C++ the constructors initialize the class object. When the instance of class is…
Q: = {a; b; c; d} and R= {(a; a); (b; c); (c; b); (d; d)Łithen R is Transitive O Equivalent O
A: A relation is said to be transitive if all the element in Set, if aRb and bRc then aRc.
Q: #include #include using namespace std; int main() { const int ROW_HOURS=6; //declare…
A: The solution for the above given question is given below:
Q: c++ computer language what is the output of the following code segment? int main() { int…
A: Given C++ Program: #include <iostream>using namespace std;void sub(int arr[], int z) { for(int…
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: C programming pseudocode pointers help. { totalInAGivenHour+=*(rawReadings+ monthNo*30*14*4 +…
A: what I understand from the question is that, you want to store the value inside the Parenthesis into…
Q: b[2] A. int В. ВОХ x.n a[2].a C. pointer to pointer to char p.n D. char x.args[3] E. int pointer v…
A: The question is on match the correct option.
Q: 1- If A=[1,2; 3,4], and B=A*2; then A*B=? O [14, 30; 28,44] O [14, 30,20,44] O [14, 20; 30,44] O…
A: Answer in step 2
Q: 3 9 12 15 ListB з | 4 1 2 Based on above memory illustrations. Complete these following fragment…
A: ArrayList class is used to create a dynamic array that contains objects.
Q: bool palindrome(const int a[], int start, int end); This function is to return true if elements from…
A: Answer: We have done some modification in your code and we have attached the code and output…
Q: #include #include //user-defined functions question! using namespace std; struct Books…
A: Here is the c++ code.
Q: ++ Struct Pointers Help: I have a file called names.txt. Write a program that reads each line and…
A: Please find the answer below :
Q: #include #include #define row 4194304 #define STRIDE 1 //change this to 2,4,8,16,32,64 and 128…
A: The C program is given below:
Q: a) b) C) d) CO 1 123 2 4 5 6 7 8 9 10 11 12 20 19 TELE 345 13 #include #include int main(){ 14 15…
A:
Q: What is the value of the variable ss after the following code is executed? int x[ 7 ] =…
A: In the given program, an array of size 7 is defined which contains 6 elements. Then, a variable ss…
Q: function carLambda = [rank, &price] ()->int { cout name); model Car::carModel; auto testLambdaPtr =…
A: In C++ programming, memory allocation for a given program, happens based on what kind of data we are…
Q: Lab 6 Use the lab5.cpp as a started file. Modify the program is it generates 1000 points with a…
A: The Algorithm of the code is as follows:- 1. Set up an array of structs to hold 1000 points2. Set up…
Q: In this code snippet that performs a binary search, what code should replace the placeholders…
A: The question asks to choose the correct expression and statement to replace placeholders in a binary…
Q: #include int arrC[10] = {0}; int bSearch(int arr[], int l, int h, int key);
A:
Q: 1. Given the following array declaration: int A [3 ][2 ]={{13, -23}, {3, 80} ,{91,55} }; declare…
A: I give the code in CPP along with output and code screenshot
Q: C++ Program You may use the vector and iostream libraries. You are allowed to use three built-in…
A: C++ Program You may use the vector and iostream libraries. You are allowed to use three built-in…
Q: int xRes-512, yRes-256; float **xtable; // pointer to pointer[s] xtable - new float*[yRes]; // a…
A: Required:
Q: #include #include #include #define EMPS_SIZE 20 #define SSN_SIZE 9 #define MAX_EMPS 19…
A: Define the Employee struct to hold information about each employee, including name, salary, year of…
Q: For the following code #include #include int powerof(int base, int pow); int _tmain(int argc,…
A: powerof is a function that takes two parameters base and pow
Q: a. Write a function read that reads the electricity information (Meter No, ĶillowattHours, Current…
A: Q: Code the given problem in C++
Q: after_2_years(years);
A: Given the arrays of integers which represents years. Now, have to write the function…
Q: 1. Implement a class IntArr using dynamic memory. a. data members: capacity: maximum number of…
A: This code defines a class named IntArr that represents an integer array. It has private members for…
Q: // index <- find the index of the RECORD with given restaurant_id in restaurant_array ????? (I…
A: The index of the RECORD has to be found with given restaurant_id in restaurant_array and if no id…
Q: (c) Suppose data had a very large length, say 106. Clearly explain which statement in the function…
A: In the given sample of code, the inbuilt sort function, uses merge sort or quick sort to sort an…
Q: Rewrite the following code while using the user-defined functions for the mentioned blocks #1 and #2…
A: You can name the two functions to block 1 and block 2, which are constructed, as you see fit. This…
Q: 1. Why does little-endian vs. big-endian matter here in this code 2. Describe how pointer casting…
A: Answer: I have given answer in the brief explanation.
Q: Rewrite the following code while using the user-defined functions for the mentioned blocks #1 and #2…
A: Declare Two Functions named display and sum and both accepts array of size 5 as its parameter. Now…
Step by step
Solved in 3 steps
- /*Line 1:*/ doublevalues[6] = {10, 20, 30, 40, 50, 60}; /*Line 2:*/ double* yalptr= values; /*Line 3:*/ cout << 3*values[1] + yalptr[3] + *(valptr + 2); A. What is 3*values[1] equal to in Line 3? (Explain) B. What is yalptr[3] equal to in Line 3? (Explain)#include <stdio.h> struct Single { int num; }; void printSingle(int f) { int binaryNum[33]; int i = 0; while(f>0) { binaryNum[i] = f % 2; f = f/2; i++; } for (int j=i-1; j>= 0; j--) { printf("%d",binaryNum[j]); } } int main() { struct Single single; single.num = 33; printf("Number: %d\n",single.num); printSingle(single.num); return 0; }Q1 #include <stdio.h> int arrC[10] = {0}; int bSearch(int arr[], int l, int h, int key); int *joinArray(int arrA[], int arrB[]) { int j = 0; if ((arrB[0] + arrB[4]) % 5 == 0) { arrB[0] = 0; arrB[4] = 0; } for (int i = 0; i < 5; i++) { arrC[j++] = arrA[i]; if (arrB[i] == 0 || (bSearch(arrA, 0, 5, arrB[i]) != -1)) { continue; } else arrC[j++] = arrB[i]; } for (int i = 0; i < j; i++) { int temp; for (int k = i + 1; k < j; k++) { if (arrC[i] > arrC[k]) { temp = arrC[i]; arrC[i] = arrC[k]; arrC[k] = temp; } } } for (int i = 0; i < j; i++) { printf("%d ", arrC[i]); } return arrC; } int bSearch(int arr[], int l, int h, int key) { if (h >= l) { int mid = l + (h - l) / 2; if…
- matrix = {{1,2},{4,5}} this in c++#include <iostream>using namespace std;double median(int *, int);int get_mode(int *, int);int *create_array(int);void getinfo(int *, int);void sort(int [], int);double average(int *, int);int getrange(int *,int);int main(){ int *dyn_array; int students; int mode,i,range;float avrg;do{cout << "How many students will you enter? ";cin >> students;}while ( students <= 0 );dyn_array = create_array( students );getinfo(dyn_array, students);cout<<"\nThe array is:\n";for(i=0;i<students;i++)cout<<"student "<<i+1<<" saw "<<*(dyn_array+i)<<" movies.\n";sort(dyn_array, students);cout << "\nthe median is "<<median(dyn_array, students) << endl;cout << "the average is "<<average(dyn_array, students) << endl;mode = get_mode(dyn_array, students);if (mode == -1)cout << "no mode.\n";elsecout << "The mode is " << mode << endl;cout<<"The range of movies seen is…#include <iostream>using namespace std;double median(int *, int);int get_mode(int *, int);int *create_array(int);void getinfo(int *, int);void sort(int [], int);double average(int *, int);int getrange(int *,int);int main(){ int *dyn_array; int students; int mode,i,range;float avrg;do{cout << "How many students will you enter? ";cin >> students;}while ( students <= 0 );dyn_array = create_array( students );getinfo(dyn_array, students);cout<<"\nThe array is:\n";for(i=0;i<students;i++)cout<<"student "<<i+1<<" saw "<<*(dyn_array+i)<<" movies.\n";sort(dyn_array, students);cout << "\nthe median is "<<median(dyn_array, students) << endl;cout << "the average is "<<average(dyn_array, students) << endl;mode = get_mode(dyn_array, students);if (mode == -1)cout << "no mode.\n";elsecout << "The mode is " << mode << endl;cout<<"The range of movies seen is…
- For the following code #include <stdio.h> #include <conio.h> int powerof(int base, int pow); int _tmain(int argc, _TCHAR* argv[]) { int x,y,z; line 3 calledIn C++Using the code provided belowDo the Following: Modify the Insert Tool Function to ask the user if they want to expand the tool holder to accommodate additional tools Add the code to the insert tool function to increase the capacity of the toolbox (Dynamic Array) USE THE FOLLOWING CODE and MODIFY IT: #define _SECURE_SCL_DEPRECATE 0 #include <iostream> #include <string> #include <cstdlib> using namespace std; class GChar { public: static const int DEFAULT_CAPACITY = 5; //constructor GChar(string name = "john", int capacity = DEFAULT_CAPACITY); //copy constructor GChar(const GChar& source); //Overload Assignment GChar& operator=(const GChar& source); //Destructor ~GChar(); //Insert a New Tool void insert(const std::string& toolName); private: //data members string name; int capacity; int used; string* toolHolder; }; //constructor GChar::GChar(string n, int cap) { name = n; capacity = cap; used = 0; toolHolder = new…i C++ 1 v class Solution { public: 1234567∞SHBH5 3 v 6 - 9 10 11 Y }; • Autocomplete char repeated Character(string s) { unordered_set u; char ans; for(char c s) { } if(u.count(c)){ aris=c; break; u.insert(c); } } return ans;
- #include <stdio.h> struct Single { int num; }; void printSingle(int f) { int binaryNum[33]; int i = 0; while(f>0) { binaryNum[i] = f % 2; f = f/2; i++; } for (int j=i-1; j>= 0; j--) { printf("%d",binaryNum[j]); } } int main() { struct Single single; single.num = 33; printf("Number: %d\n",single.num); printSingle(single.num); return 0; }2 = 0 ) { numList [ i ] i } } } [1, 2, 3, 4, 5] [0, 2, 4, 6, 8] [2, 4, 6, 8, 10] [1, 3, 5, 7, 9]#include <stdio.h> int arrC[10] = {0}; int bSearch(int arr[], int l, int h, int key); int *joinArray(int arrA[], int arrB[]) { int j = 0; if ((arrB[0] + arrB[4]) % 5 == 0) { arrB[0] = 0; arrB[4] = 0; } for (int i = 0; i < 5; i++) { arrC[j++] = arrA[i]; if (arrB[i] == 0 || (bSearch(arrA, 0, 5, arrB[i]) != -1)) { continue; } else arrC[j++] = arrB[i]; } for (int i = 0; i < j; i++) { int temp; for (int k = i + 1; k < j; k++) { if (arrC[i] > arrC[k]) { temp = arrC[i]; arrC[i] = arrC[k]; arrC[k] = temp; } } } for (int i = 0; i < j; i++) { printf("%d ", arrC[i]); } return arrC; } int bSearch(int arr[], int l, int h, int key) { if (h >= l) { int mid = l + (h - l) / 2; if…