What is the syntax for the data type of a reference to an int? int& ref int* int[]
Q: Assume the function max finds and returns the maximum value from an array of integers. Which of the…
A: There should be two parameters array and number of elements and it has to return maximum
Q: C++ language Alter the code found in main.cpp Using the file, add/change the code in the file,…
A: Coded using C++.
Q: #include #include //user-defined functions question! using namespace std; struct Books { char…
A: Here is the c++ code.
Q: Display the password from the main() function. Write a function replaceVowels() with no return value…
A: #include bits/stdc++.h using namespace std; void createPassword(char *pass) { char mx[27] =…
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: This part requires that you implement a C function that takes in as parameters two arrays and their…
A: #include <stdio.h>//method to find and print longest common sequencevoid…
Q: #include struct dna { int number; char text; char stringvalue[30]; }; int main() {…
A: NOTE: - As asked the comments are being added on each line of the program. Any modification other…
Q: #include #include //user-defined functions question! using namespace std; struct Books…
A: Here is the c++ code.
Q: // you must finish this program. it should ask how //many fish were caugh by fishermen 1-20,…
A: Complete Code in C++ #include <bits/stdc++.h> // import all libraryusing namespace std;…
Q: In this lab, you use what you have learned about searching an array to find an exact match to…
A: #include <iostream>#include <string>using namespace std; int main() { string…
Q: Write two statements to free dynamically allocated array and double which are declared as
A: In C++, we can delete as well as free pointers Syntax to free pointer: free(PointerName); Two…
Q: static int sum_calc(int arr[], int len) { int sum = 0, index = 0; while (index <= len) { sum = sum +…
A:
Q: What are the output from the C++ codes segments below? 1- {int x=10; while(x>5); { cout<<x<<"\n";…
A: The loop statements such as while and for loops run the block of code multiples times until the…
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: // MichiganCities.cpp - This program prints a message for invalid cities in Michigan. // Input:…
A: I have written the program using C++ PROGRAMMING LANGUAGE OUTPUT : CODE : //…
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: // MichiganCities.cpp - This program prints a message for invalid cities in Michigan. // Input:…
A: You need to check with each and every element in the array of strings and if it equals the input…
Q: T/F The << operator is overloaded to input data items of fundamental types, strings and…
A: Answer: Explanation: cin stream is connected to standard input device like keyboard not display.
Q: #include #include typedef struct Number_struct { int num; } Number; void Swap(Number*…
A: Code: Swap Function void Swap(Number* numPtr1, Number* numPtr2) { int temp = numPtr1->num;…
Q: Write a full c++ program to do the following:- 1- define an array (employeeSal) with 5 elements and…
A: Step 1: START. Step 2: Take input of array for salary. Step 3: Make deptIds array with given values.…
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…
Q: Write in C++ Sam is making a list of his favorite Pokemon. However, he changes his mind a lot. Help…
A: We need to write a C++ code for the given scenario.
Q: / Write a program in C++ language that enters a number of integer numbers into a singular matrix…
A: Given: Write a program in C++ language that enters a number of integer numbers into a singular…
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: int* p; int a[3] = {1, 2, 3); p = a; What is the value of *(p+2)?
A: We are we are given an array a and a integer pointer variable p. we are asked the value of *(p+2).…
Q: Code in C please. Write the code that defines a struct called pilot. The following information must…
A: Given: Write the code that defines a struct called pilot. Create struct (holds information about a…
Q: Initialize a string array named person with your first, middle and last name as separate elements.…
A: Required: Initialize a string array named person with your first, middle andlast name as separate…
Q: Discuss the role of quantum computing in the evolution of computational systems. What are the…
A: Quantum computing is a field that has the power to revolutionize the world of systems.Unlike…
Q: #include using namespace std; struct Employee { string firstName; string lastName;…
A: This program reads a text file of employee records into a linked list of Employee structs, then…
Q: You can use the following functions to do case insensitive string comparison. Place them in your…
A: It is defined as a general purpose programming language. It is object oriented and has generic…
Q: #include #include struct user { char user_name[10]; char bank_name[10]; int…
A: Flow chart is a step by step process of the program which is represented using the symbols and flow…
Q: #include using namespace std; struct Employee { string firstName; string lastName;…
A: Declare the struct for Employee with the required attributes. Define the printRecord function to…
The above question is solved in step 2 :-
Step by step
Solved in 2 steps
- ASSIGNMENT-4 1. You have to create a memory size calculator in the C language that inputs the number of elements and the datatype of an array and prints the memory size(in Bytes) occupied by the array. User will enter 'i' for integer datatype, 'b’ for Boolean, 'c' for char, 'f for float and print "Invalid data type" for any other input.use c++ Programming language Write a program that creates a two dimensional array initialized with test data. Use any data type you wish . The program should have following functions: .getAverage: This function should accept a two dimensional array as its argument and return the average of each row (each student have their average) and each column (class test average) all the values in the array. .getRowTotal: This function should accept a two dimensional array as its first argument and an integer as its second argument. The second argument should be the subscript of a row in the array. The function should return the total of the values in the specified row. .getColumnTotal: This function should accept a two dimensional array as its first argument and an integer as its second argument. The second argument should be the subscript of a column in the array. The function should return the total of the values in the specified column. .getHighestInRow: This function should accept a two…#include <iostream> #include<string.h> //user-defined functions question! using namespace std; struct Books { char title[50]; char author[50]; char subject[100]; int book_id; }; int main() { double array1[5]= {13.768,4.0,88.7689,9.12,}; struct Books Book1; strcpy( Book1.title, "C++ Programming"); strcpy( Book1.author, "D.S Malik"); strcpy( Book1.subject, "C++ basics"); Book1.book_id = 6495407; ////Block#1////// int x=4; for (x; x>=0; x--){ cout<<array1[x]<<endl; //////////////////////////////// } cout<<"///////////////////////"<<endl; ////end of Block#1////// ////Block#2////// int sum=0, i=0; for (i; i<5; i++){ cout<<static_cast<int>(array1[i])<<" "; sum= sum+array1[i]; cout<<sum<<endl; } cout<< "final value of sum="<<" "<<sum<<endl; cout<< "the average value ="<<" " <<sum/5 <<endl; cout<<"//////////////////////"<<endl; //
- A1: File Handling with struct C++ This program is to read a given file and display the information about employees according to the type of employee. Specifically, the requirements are as follows. Read the given file of the information of employees. Store the information in an array or arrays. Display all the salaried employees first and then the hourly employees Prompt the user to enter an SSN and find the corresponding employee and display the information of that employee. NOTE : S- salaryemployee , H- Hourly employee S 135-25-1234 Smith Sophia DevOps Developer 70000H 135-67-5462 Johnaon Jacob SecOps Pentester 30 60.50S 252-34-6728 William Emma DevOps DBExpert 100000S 237-12-1289 Miller Mason DevOps CloudArchitect 80000S 581-23-4536 Jones Jayden SecOps Pentester 250000S 501-56-9724 Rogers Mia DevOps Auditor 90000H 408-67-8234 Cook Chloe DevOps QAEngineer 40 45.10S 516-34-6524 Morris Daniel DevOps ProductOwner 300000H 526-47-2435 Smith Natalie DevOps…In C++ Assume that a 5 element array of type string named boroughs has been declared and initialized. Write the code necessary to switch (exchange) the values of the first and last elements of the array.Given the following declaration : char msg[100] = "Department of Computer Science"; What is printed by: strcpy_s(msg, "University"); int len = strlen(msg); for (int i = len-3; i >0; i--) { msg[i] = 'x'; } cout << msg;
- #include <stdio.h>#include <string.h> int main(){ char str[10][30] = { "Utkarsh","Ayush","Gautam", "Mustafa", "Aman", "Sonu","Rahul", "Sooraj","Mohit","Sunil"}; char temp[30]; for(int i = 0; i < 10; i++){ for(int j = 0; j < 9 - i; j++){ if(strcmp(str[j], str[j+1]) < 0){ strcpy(temp, str[j]); strcpy(str[j], str[j+1]); strcpy(str[j+1], temp); } } } printf("The names in descending order are :: \n\n"); for(int i = 0; i< 10; i++) printf("%s ", str[i]); return 0;} Extend your program in to do a binary search on the list of names. Search the 8th name from your original list and return the position of the name from the sorted name list#include <stdio.h>#include <string.h>#define SIZE 6struct Cake {char name[50];float price;};int searchChoice(char *choice, struct Cake data[]);void displayChoice(int index, struct Cake data[]);int main() {char choice[50];int index;//Answer for Part (i) – Declare and initialise array stockprintf("What is your choice of cake? ");gets(choice);index = searchChoice(choice, stock);displayChoice(index, stock);return 0;}//Answer for Part (ii) – Function definition for searchChoice//Answer for Part (iii) – Function definition for displayChoiceplease only c code dont use c++ and c#. Function write the arraylist_sort function and arraylist_remove_duplicates according to the given parameters. #include <stdio.h>#include <stdlib.h>#include <string.h> #define N 2000#define D 250 // A simple restaurant structuretypedef struct{char restaurant_name[15];double rating;char city[31];unsigned short opening_year;} RESTAURANT_t, *RESTAURANT; // Arraylist structuretypedef struct ArrayList_s{void **list;int size;int capacity;int delta_capacity;} ArrayList_t, *ArrayList; * Function: arraylist_sort* This generic function sorts an array list using the given compare function.*/void arraylist_sort(ArrayList l, int (*compare)(void *, void *)){// TODO: Fill this block./* NOTE: If you cannot write down a generic function which works for all types, write down a function which sorts resturants. If you cannot use function pointers, you can write down multiple functions which sort using different criteria.*/ } /*** Function:…
- Game of Hunt in C++ language Create the 'Game of Hunt'. The computer ‘hides’ the treasure at a random location in a 10x10 matrix. The user guesses the location by entering a row and column values. The game ends when the user locates the treasure or the treasure value is less than or equal to zero. Guesses in the wrong location will provide clues such as a compass direction or number of squares horizontally or vertically to the treasure. Using the random number generator, display one of the following in the board where the player made their guess: U# Treasure is up ‘#’ on the vertical axis (where # represents an integer number). D# Treasure is down ‘#’ on the vertical axis (where # represents an integer number) || Treasure is in this row, not up or down from the guess location. -> Treasure is to the right. <- Treasure is to the left. -- Treasure is in the same column, not left or right. +$ Adds $50 to treasure and no $50 turn loss. -$ Subtracts…#include <stdio.h>#include <string.h>#define SIZE 6struct Student{char name[50];int id;float mark;};int Search1(char input[], struct Student data[]);int Search2(int input, struct Student data[]);int main() {char search_name[30];int search_id;int result1, result2;struct Student list[SIZE] = {{"Amylia", 544199, 75.4},{"Cheong", 143566, 92.3},{"Harry", 109774, 65.5},{"Krishnan", 334514, 86.7},{"Melissa", 257890, 55.4},{"Timothy",144656, 77.8}};printf("Enter Student Name: ");gets(search_name);result1 = Search1(search_name, list);//Answer for part (a)(ii) – Display the matching index of result1printf("Enter Student ID: ");scanf("%d",&search_id);result2 = Search2(search_id,list);//Answer for part (a)(iii)- Display the matching index of result2return 0;}//Answer for part (a)(i) – function definition for Search1//Answer for part (a)(iii) – function definition for Search2