i have a quiz and i need solve it.
Question 1:
- Declare a 5-element array of integers.
- Use a for loop to enable the user to initialize the values of this array.
- use initializer list, 4 7 8 99 12, to initialize this array.
Question 2:
- Declare an array of string of length 30 characters (name it stringx).
- Read string from the user into stringx
- If you entered ‘Emad Alsuwat’, what is the output of the following:
cout<<stringx<<endl;
- What is the output of the following:
cin>>stringx;
cout<<stringx<<endl;
Question 3:
What is the output of following code?
#include<iostream.h>
using namespace std;
void main()
{
int a[10] = {2,3,4,5,6,7,8,9,1,0}, *p, *q;
p = &a[3];
q = p + 5;
p = q - 2;
p++;
cout<<"The value of p and q are"<<*p<<*q;
}
Step by stepSolved in 4 steps
- Hello, Stuck on this question. All programming is in Python. 2.) Design a program that generates a 7-digit lottery number. The program should have an INTEGER array with 7 elements. Write a loop that steps through the array, randomly generating a number in the range of 0 through 9 for each element. Then write another loop that displays the contents of the array. All programming is in Python.arrow_forwardPYTHON Complete the function below, which takes two arguments: data: a list of tweets search_words: a list of search phrases The function should, for each tweet in data, check whether that tweet uses any of the words in the list search_words. If it does, we keep the tweet. If it does not, we ignore the tweet. data = ['ZOOM earnings for Q1 are up 5%', 'Subscriptions at ZOOM have risen to all-time highs, boosting sales', "Got a new Mazda, ZOOM ZOOM Y'ALL!", 'I hate getting up at 8am FOR A STUPID ZOOM MEETING', 'ZOOM execs hint at a decline in earnings following a capital expansion program'] Hint: Consider the example_function below. It takes a list of numbers in numbers and keeps only those that appear in search_numbers. def example_function(numbers, search_numbers): keep = [] for number in numbers: if number in search_numbers(): keep.append(number) return keep def search_words(data, search_words):arrow_forwardC++arrow_forward
- I dont really have a full grasp on loops can someone explain to me this ?Store the list of denominators in your program as shown below:list_den = [2, 3, 4, 0, 5, 6, 8]Write a program that prompts the user for numbers and store the input numbers in a list of numerators called list_num. list_num must contain the same number of elements as list_den. If the user inputs a number that is lower than 10, display an error message and repeat the process until list_num contains numbers that are greater than or equal to 10.You will now divide a number in the list_num by the corresponding number from list_den and store the result in another list named result. You will use a loop to do this. For example, the first item in result will contain the result of dividing the first item in the list_num by the first item in list_den, and so on.Since list_den contains a denominator with the value 0, you will need to store -1 as the result when a division by zero is attempted.arrow_forward6) Write a program that declares a 10-element integer array. Initialise the arrays with the values: 10, 20, 30, 40, 50, 60, 70, 80, 90, 100 using a for loop. Then output the array values.arrow_forward
- Database System ConceptsComputer ScienceISBN:9780078022159Author:Abraham Silberschatz Professor, Henry F. Korth, S. SudarshanPublisher:McGraw-Hill EducationStarting Out with Python (4th Edition)Computer ScienceISBN:9780134444321Author:Tony GaddisPublisher:PEARSONDigital Fundamentals (11th Edition)Computer ScienceISBN:9780132737968Author:Thomas L. FloydPublisher:PEARSON
- C How to Program (8th Edition)Computer ScienceISBN:9780133976892Author:Paul J. Deitel, Harvey DeitelPublisher:PEARSONDatabase Systems: Design, Implementation, & Manag...Computer ScienceISBN:9781337627900Author:Carlos Coronel, Steven MorrisPublisher:Cengage LearningProgrammable Logic ControllersComputer ScienceISBN:9780073373843Author:Frank D. PetruzellaPublisher:McGraw-Hill Education