Write a complete C program, WITH ERROR CHECKING, functions and files, that reads a function (GeneratesRandoms (lower, upper, count)) that generates random integers based on the upper and lower limits given by the user. Once the program has finished generating the numbers, it should print either the total, if it is 21 or less, or the words "You lose" if the total is over 21 or the words “You win" if the total is exactly 21.You may assume that the range of integers entered by the user is between 1 and 11 (inclusive). Write your output data to a file, named testdata.
Q: Write a C program that reads an integer n ≥ 2 and prints the smallest integer d > 2 such that n is…
A: Algorithm to find the factors of the given number Take input n which must be greater than 2. Take…
Q: Write a C++ program that would implement the function called filterString which accepts a string s…
A: The required code for the Cpp function filterString is coded in the next step by using a for loop.
Q: Write a simple C program that can determine whether a machine is little- or big-endian. 2. Printing…
A: Here is the solution:-
Q: Write a program in C++ using libraries. Write a function that allows case-insensitive comparison of…
A: String: String is nothing but a sequence of characters.
Q: Write a C program that prompts the user to enter a positive integer between 100 and 9999 inclusive).…
A: Logic: - first check the range of input number. then count the number of digits if(count==3)…
Q: Let's write a C++ program function named toFrenchGender() that takes the French name of a country…
A: Algorithm: 1. First read country name 2. Check if the country belongs to any one of the country…
Q: In C++, add movies and prices to an existing text file using STL iterators, containers , or…
A: In this program we have to code a C++ program in which it will store movie name and movie price in a…
Q: Write a C++ program, which initializes a string variable to the content "Time is a great teacher but…
A: Declare the file stream pointer with the file path. write the string into the file using the…
Q: Write a C++ program that includes the following function: a boolean function with the name of…
A: #include<iostream>using namespace std;//boolean function to check number is even or odd//if…
Q: Write a C++ program that will ask the user for number of terms N and base B, and then print the…
A: I have given an answer in step 2.
Q: 15. Write a complete C program, WITH ERROR CHECKING, functions and files, that reads a function…
A: #include <stdio.h>#include <stdlib.h>#include <time.h> void GeneratesRandoms(int…
Q: Write a C++ program that would implement the function called romanToInt which returns the integer…
A: This is related to C++ Program. Code is attached along with Screenshot.
Q: Write a Python function greeting that, given a string and a name, returns a friendly greeting…
A: Please check step 2 for the code. Please see that I have used the index function to find the index…
Q: Write a program in C that will add the numbers from 1 up to and including a given positive integer,…
A: In this question we are asked to write a program in C which returns the add of numbers which are not…
Q: Write a C++ program that would implement the function called filterString which accepts a string s…
A: Here I have defined the function filterString(). Inside the function, I have looped over the string…
Q: Write a C++ program that would implement the function called filterString which accepts a string s…
A: Here I have defined the function named filterString(). In this method, I have looped over the string…
Q: 15. Write a complete C program, WITH ERROR CHECKING, functions and files, that reads a function…
A: Program description: Generates and prints 'count' random numbers in the range [lower, upper]. Input…
Q: Write a code in C++: Write a program to factor a polynomial of the form x² + bx + c, where b and c…
A: #include <iostream> //Including iostream header file#include <cmath> // Including…
Q: Write a C++ console application to find out a number is prime or non-prime. According to…
A: Program Approach: Importing the header file and using the namespace. Defining the Boolean function…
Q: Define a function in C++ language that takes an integer n as the parameter and then multiplies it by…
A: Define a function in C++ language that takes an integer n as the parameter and then multiplies it by…
Q: Write a c++ program that asks the user to enter a number and then prints all the divisors of that…
A: #include <iostream> using namespace std; int main(){ int num = 0; cout<<"\n Enter…
Q: Write a C++ program that finds either a user given number is Armstrong or not. If it is Armstrong…
A: Below is the required C++ program: - Approach: - Include the header file and use the namespace.…
Q: Write a program in C++ that reads N from numbers and then sorts those numbers and finds and prints…
A: In this question, We have to take n number from the user then sort it, after that count the integer…
Q: A Technician Engineer in a District Assembly wants to issue only even-numbered stalls to market…
A: logic:- use mod operator to find remainder 1. syntax:- stall[i]%2==1 , it means stall[i] is…
Q: Write a program in C ++ language to name a class named (Count) to calculate the population of the…
A: #include <iostream>#include <math.h>class Count{private: // data members float N, T,…
Q: Write a program C that reads N from the numbers and then sortsthose numbers and finds and prints the…
A: Size of array needs to be accepted from user. Also we need to sort the 1D array and find sum of all…
Q: Write a program in C++ that reads N of numbers and ther sorts those numbers and finds and prints the…
A: I have provided detailed code for given question in c++ below.
Q: Write a piece of C++ program that prompts the user for entering a number, say x, and prints: 1, 2,…
A: for (int i = 1; i <= num; i++) { cout << i << " "; } for (int i = num - 1;…
Q: Write a program in C++ that reads in two integers and determines and prints if the first is a…
A: Answer: #include <iostream>using namespace std;void findMultiple(int *x,int *y){ // if value…
Q: Define a function in C++ language that takes an integer n as the parameter and then divides it by 4…
A: Hi there, Please find your solution below, I hope you would find my solution useful and helpful.…
Q: Write a C++ program that would implement the function called romanToInt which returns the integer…
A: - We have to code for the conversion problem.
Q: Write a c++ program, using functions only, with the following features. 1. Program reads…
A: Actually, c++ is a powerful general purpose language.
Q: Write a c++ program that reads a list of enrollments from a file and prints a class roster for the…
A: Source code: PFB source code: #include <iostream>#include <fstream>#include…
Q: gram in C that displays the classic BINGO game, displays a BINGO card (5x5 square), and tests the…
A: Write a program in C that displays the classic BINGO game, displays a BINGO card (5x5 square), and…
Q: Write a C++ program using while or do while loop that will ask the user for number of terms N and…
A: Given: Write a C++ program using while or do while loop that will ask the user for number of terms N…
Q: Write a program in C++ language that reads three integers from the keyboard, then there is a cube…
A: #include<iostream> using namespace std; int main(){ int a,b,c,cube_a,cube_b,cube_c;…
Q: Write a C++ program: to iteratively compute Fibonacci numbers (named after an Italian…
A: A C++ program to generate fibonacci series using recursion is given below,Program://Declare header…
Q: Paste three test cases at the end of the program( put them in comment area)
A: C++ program to generate all combination of well formed parentheses
Q: Write a C program that reads a one-digit number and then displays it to the screen as a word in…
A: To read a single-digit we need to scanf a character (%c) and convert the char to int by subtracting…
Q: Write a complete C++ program that contains the integer functions (main, funx and funy). The main…
A: Input to the code : The integer k Output of code : Value evaluated by passing k in different…
Q: Write a C++ program that will prompt for and read in the names (first and last) and the final exam…
A: C++ program to prompt the user to enter the first and last names and the final exam scores of a…
Q: //write a program in C++ that reads ten positive random numbers and finds the largest d number in it…
A: code #include <iostream>using namespace std;void print_odd_high(int x[]){ int max = 0;…
Q: Write a program in C++ to read a sequence of integer numbers until a negative number is entered,…
A: Input the numbers in a vector. Create a function to find and print the sum of numbers in the vector.
Q: A program in the C language that receives from the user an actual number up to 3 digits after the…
A: #include<stdio.h>#include <math.h>void main(){ double num = 0.0; printf("Enter a…
Q: Write a C++ Program, using functions, that, given a number greater than zero (0), the user will…
A: Answer in step2
Q: A C program which counts the number of letters, digits, other characters, and total characters from…
A: #include <stdio.h>#include <ctype.h> void countString(char str[100]){ //To count…
Q: In the C program, I am trying to create a function that will separate a string by storing the two…
A: The question has been solved in step2:
Q: Write a C program that reads a double value (x) from the user and then uses it to compute the value…
A: Below is the required C code. Program Approach: Include necessary header files to get a standard…
Q: Write a complete C++ program that reads two whole numbers into two variables of type int and then…
A: #include<iostream>using namespace std;int main(){int…
Please create the
Step by step
Solved in 3 steps with 2 images
- (Numerical) Write a program that tests the effectiveness of the rand() library function. Start by initializing 10 counters to 0, and then generate a large number of pseudorandom integers between 0 and 9. Each time a 0 occurs, increment the variable you have designated as the zero counter; when a 1 occurs, increment the counter variable that’s keeping count of the 1s that occur; and so on. Finally, display the number of 0s, 1s, 2s, and so on that occurred and the percentage of the time they occurred.(Program) Write a program that tests the effectiveness of the rand() library function. Start by initializing 10 counters, such as zerocount, onecount, twocount, and so forth, to 0. Then generate a large number of pseudorandom integers between 0 and 9. Each time 0 occurs, increment zerocount; when 1 occurs, increment onecount; and so on. Finally, display the number of 0s, 1s, 2s, and so on that occurred and the percentage of time they occurred.Write a c++ program that takes a date in the following format: December 24th, 2021 and extracts the day, month, and year as 3 integers. Your program should have the following functions: (a) WriteafunctiongetDatethatpromptsausertoenteradateasastringandreturns it. (b) Write a function extract that takes as its parameter a date and returns the day, month, and year as 3 integers.use the function isdigit(c) that returns true if c is a digit character and false if otherwise. (c) Write a function convertDigits that takes as its parameter a string of digits and converts it to an int.(to convert a digit character to a digit number use static_cast<Int> ('D') - static_cast<Int>('0') where d is 0,1,...,9) (d) Write a function convertMonths that takes as its parameter a month as a string and returns a corresponding number from 1 to 12 (1 for January, . . . , 12 for Decem- ber).
- Write a C program: Write a C program that simulates coin tossing. For each toss of the coin the program should print “HEADS” or “TAILS”. Let the program toss the coin 100 times and count the number of times each side of the coin appears. Print the results. The program should call a separate function “flip()” that takes no arguments and returns 0 for tails and 1 for heads. [Note: if the program realistically simulates the coin tossing, then each side of the coin should appear approximately half the time for a total of approximately 50 heads and 50 tails.]Write a c++ program and test the “digit” function:Function Prototype: int digit(int n,int k)This function returns the kth digit of the positive integer n. For example, if n is the integer29,415, then the call digit(n,0) would return the digit 2, and the call digit(n,2) would returnthe digit 4. The digits are numbered from left to right beginning with the “zeroth” digit. Take input and display output in main function. donot use arraysWrite a c++ program that takes a date in the following format: December 24th, 2021 and extracts the day, month, and year as 3 integers. Your program should have the following functions: (a) WriteafunctiongetDatethatpromptsausertoenteradateasastringandreturns it. (b) Write a function extract that takes as its parameter a date and returns the day, month, and year as 3 integers. (c) Write a function convertDigits that takes as its parameter a string of digits and converts it to an int. (d) Write a function convertMonths that takes as its parameter a month as a string and returns a corresponding number from 1 to 12 (1 for January, . . . , 12 for Decem- ber).
- Write a C++ function void rect (int& ar, int& per, int len, int wid)that computes the area ar and perimeter per of a rectangle with length len and width wid.Test it inside the main program that inputs the length and width of a rectangle and outputsits area and perimeter. Output the value in the main program, not in the procedure.write a python program 9. You are a class teacher at a kindergarten school. As a task, you asked your students to write a paragraph. Unfortunately, you notice that most of the students did not use capital letters correctly. Your task is to write a function which takes a string as its only parameter and returns a new copy of the string that has been correctly capitalized. Your function should: Capitalize the first letter in the string Capitalize the first letter after a full-stop, exclamation mark or question mark • Capitalize the word “i" if it is in lowercase. Summary: You have to write a function that reads a string from the user and capitalizes. The string is then returned and displayed. Sample Input ('my favourite animal is a dog. a dog has sharp teeth so that it can eat flesh very easily. do you know my pet dog's name? i love my pet very much.') Sample Output My favourite animal is a dog. A dog has sharp teeth so that it can eat flesh very easily. Do you know my pet dog's name? I…Write a c++ program: Write a function named convertToLowestTerms that inputs two integer parameters by reference named numerator and denominator. The function should treat these variables as a fraction and reduce them to lowest terms. For example, if numerator is 20 and denominator is 60, then the function should change the variables to 1 and 3, respectively. This will require finding the greatest common divisor for the numerator and denominator then dividing both variables by that number. If the denominator is zero, the function should return false, otherwise the function should return true. Write a driver program that uses convertToLowestTerms to reduce and output several fractions.
- Write a c++ code and test the “digit” function:Function Prototype: int digit(int n,int k)This function returns the kth digit of the positive integer n. For example, if n is the integer29,415, then the call digit(n,0) would return the digit 2, and the call digit(n,2) would returnthe digit 4. Examples:Input: n = 29415 , k = 1 output: 9Input: n = 2 , k = 0 output: 2 Input: n = 2 , k = 1 output: index out of bound (return -1) Note: The digits are numbered from left to right beginning with the “zeroth” digit. Take input and display output in main function. do not use string libruary. so do it using while , do while or for loop.Write a C++ Program that calculates the area and perimeter of an upright rectangle.Create a struct Point that has two double values, x and y. Write a function that asks the user for a Point.Call that function twice, once to get the bottom left corner of a rectangle, and once to get the top right corner.Write another function that takes two Points and returns area and perimeter. Print out the area and perimeter.Given two points (x1, y1) and (x2, y2), the formulas to compute perimeter and area are as followsPerimeter = 2 ∗ (abs(x1 − x2) + abs(y1 − y2))Area = abs(x1 − x2) ∗ abs(y1 − y2)write a c++ program that has the following function output (): A void computes and prints the rating for each products by adding all its points thendividing by number of times it has been rated. each * = 1 point . A product is rated more than once, so the formulae issum of points of each product /number of times rated. products.txt : nike *** lego ** caco *** skype **** nike *** lego ** caco *** skype **** nike *** lego ** caco *** skype **** please help me make it simple and basic . i will be so gratful.