c++ using simple parallel arrays and a random number generator. one string should have [rock, paper, scissors] in it and I guess I can use a parallel string with numbers [0, 1, 2] in order to generate a random nnumber 0-2 that correlates to the string with the words in it...
Q: 2. Write a C++ program to fill an integer array of size 50 with random values in the range [1,100]…
A: Write a C++ program to fill an integer array of size 50 with random values in the range [1,100] and…
Q: 5.1 Given an array of float values below, write a C++ program to double all elements present at even…
A: Arrays are linear data structure. Approach to this ques is to traverse the array when you find the…
Q: What are the use cases for using the arrays and strings in the programs? List the available string…
A: According to the company guidelines, we can answer only the first question. Please repost the other…
Q: Write a C/C++ program that takes an input (array) from 1 to n (say n = 50) and displays the string…
A: 1) code: #include <stdio.h> int main(){// Declaration and initialization of variablesint n =…
Q: Write a C program that has the following functions: Time left 0:43:4- Function 1: Ask the user to…
A: Given question has asked to create a program in c Input student grades until -1 is entered. grade…
Q: 11. Write a C++ program that will generate and display a magic square. A magic square is a square…
A: Program Plan:- The first number will be stored at position (n/2, n-1). And the first number is 1.…
Q: Write a C++ program that reads an integer array a[10] and finds the max value with its position and…
A: Given that, Write a C++ program that reads an integer array a[10] and finds the max value with its…
Q: Write a c++ program to Declare an array of 10 elements dynamically and initialize each element (from…
A: Algorithm: Step1: Declare array size. Then declare the array dynamically. In our case…
Q: Find the errors in the following C program and fix them. You may directly mark the error and fix it…
A: Given code contains some error which need to be fixed for proper execution of the code.
Q: Write a c# program for below requirement Maximum in arrays is at least twice of other numbers
A: using System;class ABCD { public static int findIndexofmax(int[] a) {…
Q: Write a C/C+ program that takes an input (array) from 1 to n (say n 50) and displays the string…
A: Algorithm: Step1: Declare the variable to store the size of array and receive the value from user.…
Q: 2/Write a program in C ++ using rows to calculate the remaining area of a square of side ngth a,…
A: lets take an example given below ; Input : a = 8 Output : Area of an inscribed circle: 50.24 Input…
Q: Write a c++ program using that initializes the elements of a ten-element array named even to the…
A: Algorithm: Firstly user enter the input value form where to start the integer series. Then add the…
Q: Write a c++ program that uses that initializes the elements of a ten-element array named even to…
A: Start Declare an array a I from 1 to 9 Assign a[I]=2*I+2 I from 0 to 9 Print I and a[I] Stop
Q: Write a c programming to find out maximum and minimum of some values using function which will…
A: Introduction: Function is basically a set of statements perform some computation and produces…
Q: Solve the below program in C language. Write a C program to swap two arrays using pointers.
A: Answer Here I take two 1D array of size 10 Code #include <stdio.h> int main(){ int…
Q: Q// writing a program in C ++ language to read the values of the elements of a square matrix (4 x 4)…
A: 1) Declare the 4X4 array 2)Read the elements into the matrix 3)Display the array and simultaneously…
Q: Done Write a C++ program, which creates a 10 X 10 matrix (matrix[10][10]) and stores in it 100…
A: Here, Code instruction is given.
Q: Write a c ++ program to find the numbers of pairs of integer in a given array of integer whose sum…
A: Program Explanation:- Using the header file. Using the standard namespace input/output function.…
Q: Write a C++ program that inputs five floating point numbers from user in an array and display them…
A: Start Declare array Input elements into array Declare a pointer and initialize base address of…
Q: Write a C program using only stdio.h library that prints asterisk (*) on the screen according to the…
A: C program using only stdio.h library that prints asterisk(*):
Q: Write a C#program that displays the pattern show in the * sample executable. * * Type of loop-> your…
A: using System; class HelloWorld { static void Main() { int rows=21; int…
Q: Write a c++ program that asks the user to enter two numbers (from 100 to 999) to create a matrix…
A: Algorithm : revDigit function : Parameter : Number Step 1 : declare and initialize variable. Step…
Q: Write a C++ program that take five input by user in an array and pass it to function. Find the…
A: Below is the required C++ program: - Approach: - Importing the header files and using the…
Q: The Pascal triangle can be used to compute the coefficients of the terms in the expansion (a +…
A: Write a C program that creates a two-dimensional matrix a representing the Pascal triangle of size…
Q: Create a C++ program that will initialize an array with five elements, accept five integers and…
A: Hi. Let's move on to the code in the next step. I have included comments in the code that will…
Q: Write a C program like this read a number from user such as Key1=1556 find 1156=x(mod100) assign…
A: Solution: Given, read a number from user such as Key1=1556 find 1156=x(mod100) assign x to an…
Q: Write a C++ program that ask user to enter a choice between 0 and 2 to do different tasks. 0 for…
A: PROGRAM CODE: #include <iostream>using namespace std;float a, b;int choice;void add(int…
Q: Make a c# program using Looping Structures and Single Dimension Arrays: Ask the user to input first…
A: we need to provide C# code for Ask the user to input first and second values and based on this…
Q: 1. Write a C program to input the elements of an integer array of size 10 and then print the indices…
A: Write a C program to input the elements of an integer array of size 10 and then print the indices of…
Q: Write a C++ program that adds two numbers of different numeric data types (e.g. integers, float,…
A: write a program for addition of diff numeric data types using overloaded function add() Function…
Q: 4. Write a C++ program to print the array given below in the output. Print 't' if the array element…
A: Write a C++ program to print the given array in the output. Print 't' if the array element is true…
Q: 1. Write a C++ program that inputs an integer array of 10 elements and prints only the prime numbers…
A: Question 1: To write C++ program that inputs an integer array of 10 elements and prints only the…
Q: write a c++ program. where you have to work with a 2-d array such that each row can have different…
A: In this question, first, we will ask the user to input the number of rows. Then for each row, we…
Q: Write a C++ program that takes a char array (char *) that take your name as input, a char pointer…
A: The above question will use C++ inbuilt functions - isupper() and islower() to check if characters…
Q: Write a C++ program that read 12 integer values from user, store values in Matrix of 4 X 3. Create…
A: C++ code :- #include <iostream>#include<cmath>using namespace std;int main() { int…
Q: (4%) Implement the solution using a single thread (i.e., without using threads and only a main…
A: As per our guidelines we are supposed to answer only one question. Kindly repost the remaining…
Q: Write a program in C++ to calculate the positive difference between two one dimensional array of 20…
A: Read the numbers in two one dimensional array. Find the difference between the two corresponding…
Q: Write a C program to fill an array of 10 elements and then it will list elements of array and…
A: Below is the required C code. Program Approach: Include necessary header files to get a standard…
Q: Write a c language program to scan a character array n and an integer k from the user, then…
A: code: #include<stdio.h> int main() { char arr[] = {'a','b','c'}; //Initialize array int…
Q: Write a C++ program to reverse an array of integer values.
A: Algorithm 1. Start 2. Var arr[100], n 3. Accept size of array in n. 4. For i=0 to n-1, accept array…
Q: 2 x 2 matrix or a 3 x 3 matrix etc.? The size of the square array must not exceed 5. Check that it…
A: #include <stdio.h> int main() { int r, a[6][6], b[6][6], sum[6][6], i, j; do{printf("Enter…
Q: Write a C++ program that adds three numbers of different numeric data types (e.g. integers, float,…
A: Required: C++ program that adds three numbers of different types using function overloading.…
Q: Solve the below program in C language. Write a C program to copy one array to another using…
A: /*C program to copy an array to another array using pointers*/ #include <stdio.h> #define…
Q: Write a C program using only stdio.h library that prints asterisk (*) on the screen according to the…
A: SUMMARY:Hence, we discussed all the point.
c++ using simple parallel arrays and a random number generator. one string should have [rock, paper, scissors] in it and I guess I can use a parallel string with numbers [0, 1, 2] in order to generate a random nnumber 0-2 that correlates to the string with the words in it...
Trending now
This is a popular solution!
Step by step
Solved in 3 steps with 6 images
- THIS NEEDS TO BE DONE IN C#!! The Tourtise and The Hair In this lab, we will be simulating the classic race of the tourtise and the hare. The race will take place on two paths of 70 tiles, which spans from left to right. The path will have two lanes, one for each animal. The path will be represented as an array of 70 characters, where each character will be the following: · A dash(i.e, “-“), which represents an empty tile. · An “h”, which represents the hare on the hare lane. · A “t”, which represents the tourtise on the tortise lane. All tiles will be “empty” (i.e. set to the dash) with the exception of the tiles that are occupied by the animals. As the animals move, the previous tile the animal was on will be set to empty, and the new tile will be changed to either “h” or “t”. Tile 70 will be the finishing tile, and the first animal to that tile will be declared the winner of the race. We will use randomization to determine how far each animal will move. Since this race will be…an int variable k, an int array currentMembers that has been declared and initialized, an int variable nMembers that contains the number of elements in the array, an int variable memberID that has been initialized, and a bool variable isAMember, Write code that assigns true to isAMember if the value of memberID can be found in currentMembers, and that assigns false to isAMemberotherwise. Use only k, currentMembers, nMembers, and isAMember.. Now take any name from the user, find whether that name is present in that array or not, and print the position of that name in the array if found. Write a search method to sequentially search the name from the array. Invoke the search method from the main method. The array and the name to be searched should be passed into the search method as parameters.Now write a Java program to implement binary search for the above problem.[Hint: You can use equals() and compareTo() methods of String class.]
- In this program you will take two tables using python cars = ["Buick","Ford","Honda"]colors = ["Red","Blue","Black","White","Green"] aType = ["Sedan","SUV","Sports","Coupe","Truck"] and place them in a two-dimensional array. as follows:Buick Red Sedan Buick Blue SUV Buick Black Sports Buick White Coupe Buick Green Truck Ford Red Sedan Ford Blue SUV Ford Black Sports Ford White Coupe Ford Green Truck Honda Red Sedan Honda Blue SUV Honda Black Sports Honda White Coupe Honda Green Truck how would the flow chart be structured for this as well?A minimax or saddle point in a two-dimensional array is an element that is the minimum of its row and the maximum of its column, or vice verse. For example, in the following array11 22 33 33 99 55 66 77 77 44 99 22the element 33 is a minimax because it is the maximum of row 0 and the minimum of column 2. The element 55 is another minimax because it is the minimum of row 1 and the maximum of column 1.Write a program that reads a 4-by-3 matrix, and then prints the location and value of each minimax in the matrix. For example, it would printa[0][2] = 33 is a minimax a[1][1] = 55 is a minimaxfor the matrix shown above.Python: In this program you will take two tables cars = ["Buick","Ford","Honda"]colors = ["Red","Blue","Black","White","Green"] aType = ["Sedan","SUV","Sports","Coupe","Truck"] and place them in a two-dimensional array. as follows:Buick Red SedanBuick Blue SUVBuick Black SportsBuick White CoupeBuick Green TruckFord Red SedanFord Blue SUVFord Black SportsFord White CoupeFord Green TruckHonda Red SedanHonda Blue SUVHonda Black SportsHonda White CoupeHonda Green Truck
- 3. Write a program to find intersection of two sorted array.For example, if the two sorted arrays as input are {21, 34, 41, 22, 35} and {61, 34, 45, 21, 11}, it should returnan intersection array with numbers {34, 21}. For the sake of this Problem, you can assume that numbers ineach integer array are unique.Code in C++ Language As a cashier, you would always hate those times when customers choose to take back their order since you'd always summon your manager and yell, "Ma'am pa-void!" No matter how you hate it, you always have to do it since you have no other choice. Given (1) an array of prices of the items, (2) another array of the items the customer wishes to take back, and (3) the customer's payment, print the change of the customer. Input: The first number indicates the number of items "n" brought to the cashier. The next "n" numbers are the prices of the items. The next number indicates the number of items "m" that the customer wants to take back and not proceed. It is assured that 0 <= m <= n. The next "m" numbers are the items to be void that ranges from item 1 to item "n". The final number is the customer's payment. It is also assured that the given payment >= final price of items. INPUT: 5 103.65 650.95 10.25 1067.30 65.18 2 1 5 2000.00 Output: The change…JAVA PROGRAMMING Two words (spelt in uppercase) are similar if and only if all letters in the 1st word are in the 2nd word and all letters in the 2nd word are in the 1st word; including the same number of duplications. For example, ABBA and BABA are similar; however, BABA and BAAA are not similar. To check two words which are similar, we can use two integer arrays, each has 26 elements (as we have 26 letters), you can assume that 1st array element stores the number of letter ‘A’, 2nd array element stores the number of letter ‘B’, and so on. What you need to do now is to check whether the two integer arrays are equal to decide whether the two words are similar. We propose following UML for this question: The class TwoWords has two String instance variables. In this class, other than the constructors, accessor and mutator methods; we have two important methods: the countInfo method receives a String parameter (a word, for example) counts and stores the letters’ info in an integer…
- You’re given an array of integers and another array of three distinct integers. The first array is guaranteed to only contain integers that are in the second array, and the second array represents a desired order for the integers in the first array. For example, a second array of [x, y, z] represents a desired order of [x, x,…,x, y, y,…,y, z, z,…,z] in the first array. Write a program that sorts the first array according to the desired order in the second array. The program should perform this in place (i.e.., it should mutate the input array), and it shouldn’t use any auxiliary space. Note that the desired order won’t necessarily be ascending or descending and that the first array won’t necessarily contain all three integers found in the second array-it might only contain one or two. Please Don't Use Chat GPT Answers Sample input array = [1,0,0,-1,-1,0,1,1] order = [0,1,-1] Sample output [0,0,0,1,1,1-1,-1] Requirements: 1. Implement the above problem statement using C Programming. 2.…The bank will store a record for each account consisting of a customer number (an integer) representing the owner of the account, an account type (a single char: C for chequing, S for savings, and M for mutual fund), and the balance of the account (a double). These are kept in three arrays-an array of customer numbers, an array of types, and an array of balances. A sample of what this might look like appears below: Customer Array 102241 992944 992944 Type Array C S C Balance Array 1.29 22.50 1.24 The entries in the array correspond to one another-for example, the first slot in all three arrays represent the fact that customer number 102241 has a chequing account with $1.29 in it. As is shown, the same customer number can appear several times, as customers can have more than one account. These are called parallel arrays, because the slots in each correspond, and the really important thing about parallel arrays is that if you shuffle around anything in one array, you have to…The bank will store a record for each account consisting of a customer number (an integer) representing the owner of the account, an account type (a single char: C for chequing, S for savings, and M for mutual fund), and the balance of the account (a double). These are kept in three arrays-an array of customer numbers, an array of types, and an array of balances. A sample of what this might look like appears below: Customer Array 102241 992944 992944 Type Array C S C Balance Array 1.29 22.50 1.24 The entries in the array correspond to one another-for example, the first slot in all three arrays represent the fact that customer number 102241 has a chequing account with $1.29 in it. As is shown, the same customer number can appear several times, as customers can have more than one account. These are called parallel arrays, because the slots in each correspond, and the really important thing about parallel arrays is that if you shuffle around anything in one array, you have to…