Write complete C++ program to simulate a Magic 8-Ball, which is a fortune telling toy that displays a random response to a yes or no question. The program should prompt the user to ask a question and then display one of the responses randomly selected from the following array
Q: Write a C program that creates and array of 1000 random integers with values ranging from 0 to 99.…
A: #include <stdio.h>#include <stdlib.h>#include <unistd.h> int main(int argc, char*…
Q: Write a complete C program that declares an array of size 10 of datatype double
A: #include <iostream> using namespace std; int main(){ double arr[10]; int n;…
Q: am that would resemble banking transactions of deposits, withdrawals, bank to bank transfers, and…
A: It is defined as a general-purpose computer programming language that is concurrent, class-based,…
Q: (B) Write a Java program that crates an array of 100 random lowercase letters, and then converts a…
A: The name of the Java class is Letters. Using the block/paragraph comment write the student name and…
Q: Write a program in any language you know to calculate the GCD for a sequence of numbers, let us say…
A: Given: Write a program in any language you know to calculate the GCD for a sequence of numbers, let…
Q: A program has a String variable fullName that stores a first name, followed by a space, followed by…
A: The answer in given in the below step with proper explanation and coding example...
Q: Write a complete C program that declares an array of size 10 of datatype double, inputs 10 values…
A: Please find the answer below :
Q: Write a program in java or c# that creates an integer array of size 10 and fills the array with…
A: The programming methodology for the program is given by: Importing packages Main class Function…
Q: Using your knowledge in c++. Demonstrate a project that contains a file called "Class Grades.txt",…
A: Actually, program is a executable software that runs on a computer.
Q: Write a program which has a class called String, appropriate member functions to get input into an…
A: Given: Write a program that has a class called String, appropriate member functions to get input…
Q: Write a program in a class FlowerCounter that computes the cost of flowers sold at a flower stand.…
A: import java.util.Scanner; public class FlowerCounter { public static void main(String[] args) {…
Q: Write a program in c++ language that simulates a magic square using 3 one- dimensional parallel…
A: Hello, please find the below code. code is properly explained in the comments.
Q: Write a C program that creates and array of 1000 random integers with values ranging from 0 to 99.…
A: Code :- #include <stdio.h>#include <stdlib.h>#include <unistd.h> int main(int…
Q: Write a program in C++ that lets the user enter the total rainfall for each of 12 months into an…
A: #include <iostream> using namespace std; int main(){ double a; double sum=0;…
Q: Write a basketball program in c++ such that it implements a two-dimensional array for 5 players…
A: Need to write a C++ program that assigns randomly the points scored for each player in each quarter…
Q: Write a C# application that populates an array with 10 items and prints all N multiples. Where N is…
A: Use a loop to iterate for 10 times and input the element then iterate over the array again and check…
Q: Using your knowledge in c++. Demonstrate a project that contains a file called "Class Grades.txt",…
A: #include<iostream>#include<iomanip>#include<string>#include<fstream> using…
Q: Code an exam in Java that repeatedly asks the user to enter the capital for a province in Canada.…
A: PROGRAM INTRODUCTION: Import the required libraries. Start the definition of the main function.…
Q: Write a program named Search.java that uses a function called search_string to check whether a…
A: <<<<<<<<<<<<<<<<<<<<<<<<<…
Q: Write a program thatinputs five integers in twoarrays each. It declares a function thatacceptsfour…
A: The required C program code is given below: #include<stdio.h>#define size 5void adds(int m[],…
Q: Write a Menu Driven C++ program that creates a character array/string by taking input from user and…
A: Program: #include <iostream> #include <string> #include<bits/stdc++.h> using…
Q: Write a C program using a function called count_positives() that gets an array and counts the…
A: C is indeed one of the most popular programming language of present time. It is one of the simplest…
Q: Write a complete C++ program that randomly generates 20 integers between the rangeof 1 to 50 and…
A: Solution:Given data,The C++ code to generate the 20 random numbers with the range from “1” to “50”,…
Q: Write an Java application that prompts the user for a checking account balance and a savings account…
A: Java Code: The Balance.java application code is shown below: import java.lang.Math; import…
Q: Make a C# programming with class and method(pre written class)of: 1. Ascend! by CodeChum Hey I’ve…
A: // Code using System;class HelloWorld { static void Main() { Console.WriteLine("Enter the…
Q: Write a C++ program that assigns randomly the points scored for each player in each quarter and…
A: Program plan: Create a 2D matrix to store random points for 5×4 scores. Pass these values to…
Q: Write a program in C++ which lets user enter values into a 2D array and displays the elements of…
A: #include <iostream> using namespace std; int main(){ int i,j,no=0; cout<<"enter…
Q: THIS IS MEANT TO BE IN JAVA Write a program that reads a list of words. Then, the program…
A: // Java program to count the number// of occurrence of a word in// the given stringimport java.io.*;…
Q: 1. Write a method that returns an int array using user's inputs from the console window. The method…
A: Java Code :- package homework; import java.util.Arrays; import java.util.Scanner; public class HW8…
Q: You are to write a boarding system for a Cruise ship in java. The system will print a menu with…
A: Step 1 Algorithm: Start Create a class named Ship with name and year as its attributes Implement…
Q: Write a c++program that: Define a class student with the following fields: a. string First name b.…
A: Write a c++program that: Define a class student with the following fields: a. string First name b.…
Q: C Programming: Write a program that reads a list of words. Then, the program outputs those words…
A: #include <stdio.h>#include <string.h> void main(){int cnt = 0, c = 0, i, j = 0, k, space…
Q: Write a program in C to rotate an array by N positions. Function prototype: void shiftArr1Pos(int…
A: The C program shifts the elements from the given number of positions in the array elements. There…
Q: a c++program that: Define a class student with the following fields: a. string First name b. string…
A: It is defined as a direct descendant of C programming language with additional features such as type…
Q: Write a C# program that creates an integer array of size 10 and fills the array with numbers set by…
A: using System; public class Oddeven { public static void Main() { int[] array1 = new int[11];…
Q: Write a Java program (Hangman.java) to play the classic word game Hangman. In the game, a word is…
A: GIVEN: Write a Java program to play the classic word game Hangman. In the game, a word is randomly…
Q: Code in C++ Language As a cashier, you would always hate those times when customers choose to take…
A: The code in C++ is as follows #include <iostream> using namespace std; int main() { cout…
Q: Write a JAVA program that plays a simple trivia game. The game should have five questions. Each…
A: Define a class. Declare string type arrays for containing question and answer. Declare int type…
Q: Write a program in C++ that simulates a lottery. The program should have an array of five integers…
A: Program: //include the header files #include <iostream> #include <time.h> #include…
Q: You are to write a C program that searches through the an array that contains a sequence of numbers…
A: CODE: #include <stdio.h> int DNA[] = {1, 2, 4, 2, 2, 2, 1, 4, 4, 2, 3, 4, 4, 4, 2, 1, 4,1, 3,…
Q: Write a recursive arrayToN function which returns the concatenation of all array values as an…
A: #include <stdio.h>#define MAX_SIZE 100 /* Function declaration */void arrayToN(int arr[], int…
Q: Write a program in C++ programming language that: I. records the basic information of a patient…
A: #include <iostream>using namespace std;//method to conver Fahrenheit to celsiusvoid…
Q: Write a complete C++ program that randomly generates 20 integers between the rangeof 1 to 50 and…
A: The random number is generated by using rand() function from stdlib.h and in order to generate a new…
Q: Write a function that takes a string and calculates the number of letters and digits within it.…
A: In this problem we need to design the pHP program. Input - String Ouput - Array
Q: Write a C++ program that declares an array alpha of 50 components of type double. Initialize the…
A: Given: C++ program that declares an array alpha of 50 components of type double. Initialize the…
Q: In C++ language, write a program to print "Junior" if the given array element starts with 'J' and…
A: In C++ language, write a program to print "Junior" if the given array element starts with 'J' and…
Q: Write a basketball
A: An array is a linear data structure where the elements are stored sequentially. Each element may be…
Q: Write a C++ program that reads an integer variable named maxAllowed and in output prints all…
A: Step 1 : Start Step 2 : Declare the Integer Array and initialize the array with the given integers.…
Q: Write a c++ program that prompts the user to enter a word and then prompts the user for a letter.…
A: Required: Write a c++ program that prompts the user to enter a word and then prompts the user for a…
Write complete C++
string magic8arr[] = {
"Yes, of course!",
"Without a doubt, yes.",
"You can count on it.",
"For sure!",
"Ask me later.",
"I'm not sure.",
"I can't tell you right now.",
"I'll tell you afterwards.",
"No way!",
"I don't think so.",
"Without a doubt, no.",
"The answer is clearly, NO."
};
Sample out is:
Enter a yes or no question: Will it rain today?
Ask me later.
Trending now
This is a popular solution!
Step by step
Solved in 3 steps with 1 images
- Write a program in c++ language that simulates a magic square using 3 one- dimensional parallel arrays of integer type. Each one of the arrays corresponds to a row of the magic square. The program ask the user to enter the values of the magic square row by row and informs the user if the grid a magic square or not. The Lo Shu Magic Square is a grid with 3 rows and 3 columns. It has the following properties: - the grid contains the numbers 1-9 exactly - the sum of each row, each column and each diagonal all add up to the same number. Input for this project - values of the grid(row by row) Output for this project - whether or not the grid is magic square Global constants - const int ROWS = 3; - const int COLS = 3; -const int MIN = 1; -const int MAX = 9; Use following functions: - void fillArray(int arrayRow1[], int arrayRow2[], int arrayRow3[], int size): accepts 3 int arrays and as a size as arguments and fill the arrays out with values entered by the user. - void showArray(int…Write a Java program: A palindromic number or palindrome number is a number that remains the same when its digits are reversed. Like 16461. Write a Java program that implements the helper method isPalindrome() that decides whether a given int number is a palindrome or not. Do not use ready String class functions like reverse() or arrays and array functions!!! Input FormatA line contains an Integer N. Constraints 1 <= N <= 999999 Output FormatA text containing either "This number is a palindrome" or "This number is not a palindrome" (the code should have the structure as in the picture)Write a C# program that asks the user to enter a sentence, and then counts the number of words in the sentence. Your program should do the following: Ask the user to enter a sentence using the Console.ReadLine() method. Use the Split() method to split the sentence into words based on spaces. for example: // Split the sentence into words based on spaces string[] words = sentence.Split(' '); Count the number of words in the sentence using the Length property of the resulting array. Print a message to the console indicating the number of words in the sentence using the Console.WriteLine() method. Provide the code for your program (the .cs file). Example output: Enter a sentence: The quick brown fox jumps over the lazy dog. The sentence contains 9 words.
- Help writing a program in c++ that asks a user for a number (variable num) and then takes that number input to print out the nth term of a sequence? The sequence begins with 1 and then every number after is a prime factor of 3, 4, or 6. This needs to be done without using vectors or arrays. . . . For example: Sequence is : 1, 3, 4, 6, 8, 9, 12, 16, 18, 20, ... (cont.) User input (num) is : 6 Output : 12 (6th term) . . Please add comments explaining the code for better understanding if possible, thank you!!Create a program in C that stores the information of up to 25 containers loaded on ship.Ask the user for the number of containers to be loaded. If the user enters a number of containersgreater than 25 or less than 3, then re-prompt for the container number until an acceptable number isentered.Create an array of floats with six rows and a number of columns equal to the number of containersprovided by the userDisplay a menu to do the following:- A or a to add a container.- D or d to delete a container.- R or r to retrieve the information of one container.- T or t to retrieve the information of all containers.- W or w to retrieve the total weight of the loaded containers.- C or c to retrieve the total cubic volume of the containers loaded on the ship (array).- V or v to retrieve the total value of the containers loaded on the ship.- X or x to exit the programOption A: for this option check if the array has an empty column to enter the information for acontainer, if not, output a message…Write a program in C++ that lets the user enter the total rainfall for each of 12 months into an array of double. The program should calculate and display the total rainfall for the year, the average monthly rainfall, and the months with the highest and lowest amounts. Input Validation: Do not accept negative numbers for monthly rainfall figures. At the end, the program should display a list of months, sorted in order of rainfall, from highest to lowest.
- Write a program in java or c# that creates an integer array of size 10 and fills the array with valuesset by the programmer (not entered by the user). Then, the program will remove all theprime numbers from the original array and store them in a new array. Note that afterthe program finishes execution, the original array should not contain any prime number.Write in c language, please. Thank you in advance. Declare an array named sandwichesInStore that stores 3 items of type Sandwich. #include <stdio.h>#include <string.h> typedef struct Sandwich_struct { char sandwichName[75]; char ingredients[75];} Sandwich; int main(void) { /* Your code goes here */ strcpy(sandwichesInStore[0].sandwichName, "Chicken and Bacon"); strcpy(sandwichesInStore[1].sandwichName, "Chicken breast"); strcpy(sandwichesInStore[2].sandwichName, "Chicken with peppers"); strcpy(sandwichesInStore[0].ingredients, "Crispy chicken, onions, lettuce, bacon, mayonnaise"); strcpy(sandwichesInStore[1].ingredients, "Grilled chicken, lettuce, tomato"); strcpy(sandwichesInStore[2].ingredients, "Grilled chicken, red and green peppers, barbecue sauce"); printf("%s: %s\n", sandwichesInStore[0].sandwichName, sandwichesInStore[0].ingredients); printf("%s: %s\n", sandwichesInStore[1].sandwichName, sandwichesInStore[1].ingredients); printf("%s:…Write a c program that will find the consonant letters from a string message and copy that consonant into another array then print that consonant array in the main. Take the input from the user. You have to use the following function prototype: void getConsonantArray (char *message, char *consonantArr) Input: North South University Output: Nrth Sth nvrsty
- C Programming: Write a program that reads a list of words. Then, the program outputs those words and their frequencies. The input begins with an integer indicating the number of words that follow. Assume that the list will always contain less than 20 words. Each word will always contain less than 10 characters and no spaces. Ex: If the input is: 5 hey hi Mark hi mark Then, the output is: hey 1 hi 2 Mark 1 hi 2 mark 1 Hint: Use two arrays, one array for the strings and one array for the frequencies.You are to write a C program that searches through the an array that contains a sequence of numbers in an and that a end with the number zero. That array should be declared and initialized exactly as follows in your program: int DNA[] = {1, 2, 4, 2, 2, 2, 1, 4, 4, 2, 3, 4, 4, 4, 2, 1, 4, 1, 3, 3, 2, 1, 3, 2, 1, 1, 2, 2, 2, 3, 4, 1, 3, 1, 2, 1, 4, 4, 4, 1, 1, 3, 1, 4, 2, 4, 4, 1, 4, 4, 1, 4, 4, 4, 4, 1, 1, 2, 3, 3, 3, 3, 4, 4, 3, 2, 3, 2, 3, 4, 3, 3, 4, 4, 1, 3, 3, 2, 1, 2, 3, 1, 2, 1, 3, 3, 2, 1, 4, 1, 4, 3, 4, 4, 4, 1, 2, 1, 3, 2, 0}; Your program should repeatedly ask the user for two things: the length of a search sequence, and the search sequence itself. The program should then search through the array “DNA” to find the starting element subscript (index) of all possible matching sequences. The elements of the search sequence may take on one of five characters: 1,2,3,4 and 5. The meaning of the ‘5’ character is that of wild card, i.e. it matches 1,2,3 and 4. The program…Write a python or C# program that creates an integer array of size 10 and fills the array with positive numbers set by the programmer (not entered by the user). The range of values in the array should be between 1 and 100. Then, the program will remove the duplicate values found in the array (i.e. each value should be found only once in the array). After removing the duplicate values, the size of the new array should be equal to the number of unique values found in the original array.