Write a C++ program that displays the list of perfectnumbers up to n. by the user; ensure that n is a positive number less than 1000.
Q: Using C++ Write a void function GetYear that prompts for and inputs the year the operator was born…
A: Your C++ program is given below as you required with an output. Code Explanation :- The GetYear…
Q: c++, Thank you Write a program that finds word differences between two sentences. The input begins…
A: Code is given below-
Q: Given an array of integers, write a C++ code snippet ( a code snippet is a self-contained piece of…
A: Initializе variablеs to storе thе smallеst еlеmеnt and thе sum of all thе еlеmеnts in thе…
Q: Following is the formula for calculating the mean or average of a set of values: X_mean =…
A: First, we will input the value of n. Then we will ask the user to input all the "n" numbers. We will…
Q: WorkAreal Instructions Write the definition of function int integerCubeRoot(int n). The function…
A: The function starts with result initialized to 0.It iteratively increments it until result * result…
Q: Your goal is to modify your Assignment 6 program to allow the user to pick up a random item and…
A: The C++ Code is below along with code image and output:
Q: ii. Add a function named count_all() to this program that takes two parameters, a list of…
A: THE ALGORITHM OF THE CODE:- 1. Define a function that takes two arguments, x and y. 2. Initialize a…
Q: Write a C++ function named getLowerAlphabets that takes a C-string argument and returns a C-string…
A: In this question we have to write a C++ function to get lower alphabets from the Char string and…
Q: Write a function named printN that takes an int n, a string s, and returns void. This function must…
A: The C++ program uses a function named printN to print the string to the given integer times. A…
Q: Write a for loop to print all elements in courseGrades, following each element with a space…
A: Here is the c++ code: See below step
Q: Write a C++ prorgam with a function named getRandomMidpoint. This function should accept two…
A: PROGRAM: //Header file #include <iostream> #include<time.h> //Using namespace using…
Q: Consider the following function: def double_all(numbers): ""Doubles all the elements in the given…
A: I give solutions to both parts and also give code with output and code screenshots in 2 parts as per…
Q: Write a program that gets a list of integers from input, and outputs the integers in ascending order…
A: Programming approach Here, we have used the concept "passing a vector by reference" to sort the list…
Q: java c++ here is my question (Evaluate expression) Modify Listing 20.12, EvaluateExpression.java, to…
A: import java.util.*;import java.lang.*;public class Main{ //to return precedencestatic int Prec(char…
Q: In c++ please. Thank you! A contact list is a place where you can store a specific contact with…
A: Required language is C++:
Q: In C, Given an int variable n that has already been declared, write some code that repeatedly reads…
A: //include the required header file #include <stdio.h> //define main function int main() {…
Q: Write a C++ program that simulates online shopping. Declare a variable cart to be an empty…
A: I give the code in C++ along with output and code screenshots.
Q: Complete the function below that takes in three integers (a,b,c) and returns the number of integers…
A: Answer:
Q: Write a c++ program that randomly fills in 0s and 1s into a 4-by-4 square matrix, prints the…
A: Algorithm: 1. make an irregular square matrxi, with sections 0 and 1, to such an extent that 2.…
Q: Write a program that allows the user to enter a number between 1 and 1000. If the number is…
A: import math def isPrime(n): if (n <= 1): return False if (n <= 3): return…
Q: please code in python Write a function that receives a string and a number (n) as parameters and…
A: To implement everyNth(), strings concept in python is used.
Q: In C++, an int is in the range 0 to 65535. But what if we need to add larger integers? Compute the…
A: Given: In C++, an int is in the range 0 to 65535. But what if we need to add larger integers?…
Q: Is Prime Function Write a well-documented Python program, hmwk4Q1.py, that defines a function…
A: The Algorithm of the code:- 1. Start.2. Define a function isPrime(N) which will return false if…
Q: in C++ Write a program that accepts a string of text ENTERED BY THE USER. Program must accept any…
A: Huffman Coding Algorithm:1. Create a frequency table for characters in the given input text.2.…
Q: In C++ Write a recursive function that displays a string reversely on the console using the…
A: Introduction Recursion is a C++ procedure that repeatedly calls itself until a predetermined…
Q: Your math teacher has asked you to write a program that grades the multiple-choice questions in a…
A: Algorithm: Create a list called "correctAnswers" containing the correct answers to the math exam.…
Q: Write a program in C++ that allows the user to enter the last names of five candidates in a local…
A: Here is your solution step by step -
Q: Create a class reversstring in c++andWrite a function called reversit () that reverses a C-string…
A: C-string : A cstring is similar to a string that stores the characters in an array starting from the…
Q: C++ only. Do not copy. Correct code will upvoted else downvote. play out the accompanying…
A: Here have to determine about c++ code for string becomes vacant problem.
Q: In C++, write a function isVowel that returns true if a character is a vowel (whether you want to…
A: 1. Start2. Create a string variable str.3. Create an int variable count and initialize to 0.4.…
Q: Write a C++ program (practice4.2.1.CheckNumbers.cpp) that lets the user enter a series of integers,…
A: Odd and Even numbers concept: Even number: A whole number that is divisible by 2 or multiple of 2 is…
Q: In c++ and please without the use of vectors. Thanks very much! A contact list is a place…
A: source code #include <iostream>#include <vector>#include <string> using namespace…
Q: Write a c++ program that uses while loop(s) to perform the following steps: Prompt the user to…
A: For the first question:The program you provided prompts the user to enter two integers (firstnum and…
Q: Exercise III: Catalan numbers For n e N, denote by c, to be the number of ways to form a "mountain…
A: Answer: Our guidelines is answer the first three question from the first question. I have given…
Q: In Python3, write the code for a function mult_3 that returns a list of all non-negative multiples…
A: The method takes parameter n list of all non-negative multiples of 3 that are less than or equal to…
Q: Write a fragment of C code that determines if a number n is prime. In your solution you must use a…
A: //include the required header files #include <stdio.h> //define the main method int main() {…
Q: For this project the program should be made in C++ Write a menu driven program that reads an array…
A: The given C++ program is designed to provide a user-friendly interface for handling a set of 10…
Q: In C language / Please don't use (sprint) function. Write a function fact_calc that takes a string…
A: In this question we have to write a C program to print the factorial of the number as provide…
Q: your goal is to modify your assignment 6 program to allow the user to pick up a random item and…
A: Algorithms: START //This program create the sorting and random number for (int i = 0; i <…
Step by step
Solved in 4 steps with 2 images
- In c++ and without the use of vectors, please. Thanks very much! A contact list is a place where you can store a specific contact with other associated information such as a phone number, email address, birthday, etc. Write a program that first takes as input an integer N that represents the number of word pairs in the list to follow. Word pairs consist of a name and a phone number (both strings). That list is followed by a name, and your program should output the phone number associated with that name. Define and call the following function. The return value of FindContact is the index of the contact with the provided contact name. If the name is not found, the function should return -1 This function should use binary search. Modify the algorithm to output the count of how many comparisons using == with the contactName were performed during the search, before it returns the index (or -1). int FindContact(ContactInfo contacts[], int size, string contactName) Ex: If the input is: 3…Write a C++ program that breaks string s1 into "tokens" ( logical pieces such as wordsin a line of text) separated by character contained in const char s2. size parameter will be updated number of tokens and save actual tokens in char**& listOfTokens. PROTOTYPE: void StrTok(char* s1, const char s2, char**& listOfTokens , int& size)In c++ and please without the use of vectors. Thanks very much! A contact list is a place where you can store a specific contact with other associated information such as a phone number, email address, birthday, etc. Write a program that first takes as input an integer N that represents the number of word pairs in the list to follow. Word pairs consist of a name and a phone number (both strings). That list is followed by a name, and your program should output the phone number associated with that name. Define and call the following function. The return value of FindContact is the index of the contact with the provided contact name. If the name is not found, the function should return -1 This function should use linear search. Modify the algorithm to output the count of how many comparisons were performed during the search, before it returns the index (or -1). int FindContact(ContactInfo contacts[], int size, string contactName) Ex: If the input is: 3 Joe 123-5432 Linda 983-4123…
- In c++ Write a for loop to print all elements in courseGrades, following each element with a space (including the last). Print forwards, th backwards End each loop with a newline. Ex If courseGrades (7, 9, 11, 10), print: 7 9 11 10 10 11 9 7 Hint Use two for loops. Second loop starts with i=NUM VALS-1. (Notes) Note: These activities may test code with different test values. This activity will perform two tests, both with a 4-element array (int courseGrades(4) See 'How to Use zyBooks Also note: If the submitted code tries to access an invalid array element, such as courseGrades[9] for a 4-element array, the test may generate strange results. Or the test may crash and report "Program end never reached", in which case the system doesn't print the test case that caused the reported message 32344345730rity? 2 using namespace std; 3 4 int main() { 5 6 7 8 9 10 11 12 13 14 const int NUM VALS-4; int courseGrades [NUM VALS]; int i; for (i = 0; i > courseGrades[1]; } y Your solution goes here Y2) Write a script AreaMenu that will print a list consisting of "rectangle" and "cylinder". It prompts the user to choose one, and then prompts the user for the appropriate quantities (e.g., the radius of the cylinder) and then prints its area. If the user enters an invalid choice, the script simply prints an error message. The script should use a nested if-else statement. Here are two examples of running it: * >> AreaMenu Menu 1. Rectangle 2. Cylinder Please choose one: 2 Enter the radius of the Cylinder: 2 Enter the height of the Cylinder: 4 The area is 50.26 >> AreaMenu Menu 1. Rectangle 2. Cylinder Please choose one: 1 Enter the length: 3 Enter the width: 5 The area is 15.00Write in c++ and submit via Canvas a program that performs the following: Allow the user to enter: Time for one calculation entered in seconds. Typical entry would look like: 0.0002. Low, Middle and High iteration times: Example: Low: 100, Middle: 1000, High 10000. Program will then perform the calculations for Algorithm total computation time for the following worst-case order of magnitude. Note this is purely a calculation and not an implementation of any algorithms that fall into these computational classes. All calculations should be declared in double (floating point) format. Students should not worry about checking for or trapping any overflow conditions. The log function that should be used is log2. Log2 (n) (n) N log2 (n) n^2 n^3 n! 2^n 3. When any of the calculated times goes over the following boundaries change the units of time that are printed: => 60 seconds convert to minutes => 60 minutes convert to hours => 24 hours convert to days => 365 days convert to…
- Use C++ Write a program that first gets a list of integers from input. The input begins with an integer indicating the number of integers that follow. Then, get the last value from the input, and output all integers less than or equal to that value. Ex: If the input is: 5 50 60 140 200 75 100 the output is: 50 60 75 The 5 indicates that there are five integers in the list, namely 50, 60, 140, 200, and 75. The 100 indicates that the program should output all integers less than or equal to 100, so the program outputs 50, 60, and 75. For coding simplicity, follow every output value by a space, including the last one. Such functionality is common on sites like Amazon, where a user can filter results. Write your code to define and use two functions:vector<int> GetUserValues(vector<int>& userValues, int numValues)void OutputIntsLessThanOrEqualToThreshold(vector<int> userValues, int upperThreshold) Utilizing functions helps to make main() very clean and intuitive.In c++, please! Thank you! Write a void function SelectionSortDescendTrace() that takes an integer array and sorts the array into descending order. The function should use nested loops and output the array after each iteration of the outer loop, thus outputting the array N-1 times (where N is the size). Complete main() to read in a list of up to 10 positive integers (ending in -1) and then call the SelectionSortDescendTrace() function. If the input is: 20 10 30 40 -1 then the output is: 40 10 30 20 40 30 10 20 40 30 20 10 The following code is given: #include <iostream> using namespace std; // TODO: Write a void function SelectionSortDescendTrace() that takes// an integer array and the number of elements in the array as arguments,// and sorts the array into descending order.void SelectionSortDescendTrace(int numbers [], int numElements) { } int main() { int input, i = 0; int numElements = 0; int numbers [10]; // TODO: Read in a list of up to 10 positive…In C language please: Write a function called printprime that takes the parameter N that prints all the prime numbers from 1 to N.
- 8. using c++, Write a function method that determines the mean of all the values in an array of integers. Your mean function should call a separate function that you write that determines the sum. Don’t use built-in sum or mean gadgets, but roll your own.I need to solve this in C++ code When analyzing data sets, such as data for human heights or for human weights, a common step is to adjust the data. This can be done by normalizing to values between 0 and 1, or throwing away outliers. For this program, adjust the values by subtracting the smallest value from all the values. The input begins with an integer indicating the number of integers that follow. Assume that the list will always contain less than 20 integers. Ex: If the input is: 5 30 50 10 70 65 the output is: 20 40 0 60 55 For coding simplicity, follow every output value by a space, even the last one. Your program must define and use the following function:int GetMinimumInt(vector<int> listInts) Note: This is a lab from a previous chapter that now requires the use of a function.Write a c++ program that prompts the user to enter a word and then prompts the user for a letter. Your program should count the number of times the letters entered appear in the word and then continue prompting for new letters. At the end of the program a list of all the letters found should be displayed. (Hint: use and array of size 26 to keep track of the letters found)