The Element shifter program illustrates the use of functions and arrays
Arrays are used to hold multiple valuesFunctions are used as subroutines of a programThe Element shifter programThe Element shifter program written in C++, where comments are used to explain each action is as follows:
#include <iostream>
using namespace std;
//This declares the ElementShifter function
int* ElementShifter(int *arr, int size){
//This declares the new array
int *newArr = new int[size * 2];
//The following loop populates the new array
for (int i = 0; i < size * 2; i++) {
if(i == 0){
*(newArr+i) = 0;
}
else if(i < size+1){
*(newArr+i) = *(arr+i-1);
}
else{
*(newArr+i) = 0;
}
}
//This returns a pointer to the new array
return newArr;
}
//The main method begins here
int main(){
//This declares and gets input for N
int N; cin>>N;
int myArr[N];
//If N is between 1 and 50
if(N > 0 && N <=50){
//This populates the array
for(int i = 0; i<N; i++){
cin>>myArr[i];
}
//This calls the Element shifter function
int *ptr = ElementShifter(myArr, N);
//This prints the new array
for (int i = 0; i < N*2; i++) {
cout << ptr[i] << " ";
}
}
return 0;
}
Read more abou C++ programs at:
https://brainly.com/question/27246607
9.11: Array Expander
Write a function that accepts an int array and the array’s size as arguments. The function should create a new array that is twice the size of the argument array. The function should copy the contents of the argument array to the new array, and initialize the unused elements of the second array with 0. The function should return a pointer to the new array. Demonstrate the function by using it in a main program that reads an integer N (that is not more than 50) from standard input and then reads N integers from a file named data into an array. The program then passes the array to your array expander function, and prints the values of the new expanded array on standard output, one value per line. You may assume that the file data has at least N values.
Prompts And Output Labels. There are no prompts for the integer and no labels for the reversed array that is printed out.
Input Validation. If the integer read in from standard input exceeds 50 or is less than 0 the program terminates silently.
The Array Expander is an illustration of arrays and functions.
Arrays are variables that stores multiple valuesFunctions are named statements that are executed when calledThe Array Expander programThe Array Expander program written in C++, where comments are used to explain each action is as follows:
#include <iostream>
using namespace std;
//This declares the Array Expander function
int* ArrayExpander(int *oldArr, int size){
//This declares the new array
int *newArr = new int[size * 2];
//This iteration sets values into the new array
for (int i = 0; i < size * 2; i++) {
if(i < size){
*(newArr+i) = *(oldArr+i);
}
else{
*(newArr+i) = 0;
}
}
//This returns a pointer to the new array
return newArr;
}
//The main method begins here
int main(){
//This declares the length of the array, N
int N;
//This gets input for N
cin>>N;
int initArr[N];
//If N is between 1 and 50
if(N > 0 && N <=50){
//This iteration gets values for the array
for(int i = 0; i<N; i++){
cin>>initArr[i];
}
//This calls the Array Expander function
int *ptr = ArrayExpander(initArr, N);
//This iteration prints the elements of the new array
for (int i = 0; i < N*2; i++) {
cout << ptr[i] << " ";
}
}
return 0;
}
Read more abou C++ programs at:
https://brainly.com/question/27246607
Put the steps of the decision-making process in the correct order.
1. Step 1
Gather data.
2. Step 2
Analyze choices.
3. Step
Make the decision.
4. Step 4
Evaluate the decision.
5. Step 5
Determine the goals.
Answer:
step 5, step 1, step 2, step 3, step 4
Explanation:
I belive that would be the answer. I hope this helps.
Use HTML and CSS, create a web page for the table shown below. Please copy (and paste) your code from your text editor (Replit).
what does the GPU do?
Answer:
With graphics processing units (GPU), many pieces of data can be processed simultaneously, which makes them useful for applications such as machine learning, editing, and gaming. It is an electronics circuit capable of accelerating the processing of images, animations, and videos.
Explanation:
What year was internet inverted
[tex]\large\blue{\mid{\underline{\overline{\tt { →\:January \:1, 1983}\mid}}}}[/tex]
ARPANET→Advanced Research Projects Agency Networkthe forerunner of the Internet.[tex]\purple{\rule{15mm}{2.9pt}} \red{\rule18mm{2.5pt}} \orange{ \rule18mm{2.5pt}}[/tex]
[tex]\sf{\:мѕнαcкεя\: ♪...}[/tex]
A common test for divisibility by 3 is to add the individual digits of an integer. If the resulting sum is divisible by 3 then so is the original number. Program this test. To do this, first define a function: reduce(number) which returns the sum of the digits of the number argument. The sum returned must be < 20 i.e. if the sum is >= 20, the function must add the digits of the resulting sum. It should repeat this procedure until the sum is < 20. Use this function in a python program that inputs an integer from the user and prints out whether or not the integer is divisible by 3.
The function to test for divisibilty by 3 will accept an input integers and divide it by three to check if its divisible by 3.
The function to test for divisiblity by 3 is as follows:
integer = input("input the integer to check if it's divisible by 3: ")
def reduce(integer):
list1 = []
sum1 = 0
for i in str(integer):
list1 += i
results = list(map(int, list1))
for x in results:
sum1 += x
if sum1 < 20 and sum1%3==0:
return "The integer is divisible by 3"
elif sum1 < 20 and sum1%3 != 0:
return "The integer is not divisible by 3"
else:
while sum1 >= 20:
z = sum(list(map(int, list(str(sum1)))))
if z%3==0:
return "The integer is divisible by 3"
else:
return "The integer is not divisible by 3"
print(reduce(integer))
Code explanationThe integer variable stores the users input.We define a function called "reduce". The reduce function accepts the interger variable as a parameter.The code loop through the integer and check if it is divisible by 3. If the sum of the integer number is greater or equals to 20, we divide the resulting sum by 3 .If the integer is divisible by 3, we return "it is divisble by 3" and if it is not dividible by 3, it will return "it is not divisble by 3".learn more on python here: https://brainly.com/question/13437928
How many bytes/second is a 16Mbps cable modem connection?
Answer:
data transfer rate converter computer connection speed cable modem online converter page for a specific...cable modem to megabit per second(Mbps)
12.2 E-Z LOAN
A loan obtained from a lending institution is typically paid off over time using equal monthly payments over a term of many months. For each payment, a portion goes toward interest and the remaining amount is deducted from the balance. This process is repeated until the balance is zero. Interest is calculated by multiplying the current balance by the monthly interest rate, which is usually expressed in terms of an Annual Percentage Rate (APR). This process produces an Amortization Schedule where the amount applied to interest is gradually reduced each month and the amount applied to the balance grows. For example, the following amortization schedule is for a loan of $ 10.000 at an APR of 3.9% over a term of 30 months:3 will match months 12, 24, and 30 respectively.
Following an amortization schedule, the monthly payments will be $350.39 and the total payment in 30 months will be $10511.7.
How much should be paid monthly to complete loan payment in 30 months?The loan payment follows an amortization schedule where the amount applied to interest is gradually reduced each month and the amount applied to the balance grows.
The amounts to be paid is calculated using the amortization formula:
P = a ÷ {{[(1 + r/n)^nt] - 1} ÷ [r/n(1 + r/n)^nt]}where
P is monthly paymenta is credit amountr is the interest ratet is the time in yearsn is number of times the interest is compoundedFor the loan of $10000;
a = $10000r = 3.9% = 0.039nt = 30 monthsHence,
P = $10000 ÷ {{[(1 + 0.039/12)^60] - 1} ÷ [0.039/12(1 + 0.0.039/12)^60]}
P = $350.39 per month
Total payment in 30 months = $350.39 × 30 = $10511.7
Therefore, the monthly payments will be $350.39 and the total payment in 30 months will be $10511.7.
Learn more about amortization schedule at: https://brainly.com/question/26433770
Identify three (3) general-purpose computing devices and write a short (no more
than one page) essay explaining in detail the computing process
The three (3) general-purpose computing devices used around the world are:
Desktop computersSmartphoneTabletWhat is computing?Computing refers to a process which involves the use of both computer hardware and software to manage, analyze, process, store and transmit data, so as to complete a goal-oriented task.
In Computer technology, a general-purpose computing device is a type of computer that can perform most common computing tasks when provided with the appropriate software application. Thus, three (3) general-purpose computing devices include the following:
Desktop computersSmartphoneTabletRead more on computing here: https://brainly.com/question/19057393
What are the four steps of the binary search algorithm
Answer:
Step 1 - Read the search element from the user.
Step 2 - Find the middle element in the sorted list.
Step 3 - Compare the search element with the middle element in the sorted list.
Step 4 - If both are matched, then display "Given element is found!!!" and terminate the function.
Answer:
These are the main steps are given the photo below
I hope my answer helps you.
Which one of the following tuned-adm commands will set the Tuning Profile to desktop?
The "yum search tuned" command. tuned-adm commands will set the Tuning Profile to desktop.
What is tuning profile?The term Tuned is known to be a form of daemon that employs the use of udev to look into connected devices and so it also statically or dynamically tunes system settings based on a clicked profile.
Conclusively, Tuned is known to often shared with a number of predefined profiles that are often used in some common use cases such as high throughput, low latency, etc.
Learn more about tuning profile from
https://brainly.com/question/23275071
Question 1 (1 point)
Jenna has created a wizard class. She has used the class to build two wizard objects
a
in her game. Which programming term describes the objects that Jenna built using
the wizard class?
A. Occurrences
B. Subclasses
C. Instances
D. Methods
Answer:
Subclasses
Explanation:
It's B for Plato students, took this not that long ago!
What is a value which we pass to the function to use in place of the parameter when we call it?
A. Parameter
B. Call
C. Procedure
D. Argument
19) If you want to find your lowest paid, full time employee (with "FT" in column B and each employee's salary found in column C), you would use the ________ function.
A. IFSMAX
B. MAXIF
C. MIN
D. MINIFS
Answer:
MAXIF
Explanation:
The MAXIF function is a function used in Ms Excel.
This function indicates the maximum value located on an array .Option B
Answer:
MaxifExplanation:
If you want to find your lowest paid, full time employee (with "FT" in column B and each employee's salary found in column C), you would use the MAXIF function.
which is considered both an input and output device?
A) Keyboard
B) Microphone
C) Speaker
D) Touchscreen Monitor
Please hurry :3 15 points
Answer:
speaker
Explanation:
its the one that gives sounds
Answer:
The answer would be D) Touchscreen Monitor
Explanation:
A Touchscreen monitor (such as a smartphone screen) outputs information to the user, while also recieving information from the user.
how to Develop Administrative Assistant Skills
Answer:
Multitasking, Flexible and resourceful.
Explanation:
im not sure what your asking for but to be or i dont now how to explain to good but hope you get what im mean it no brainier
positive and negative of adblock plus
Answer:
Pros and cons of ad blockers
Remove distracting ads, making pages easier to read.
Make web pages load faster.
Keep advertisers from tracking you across websites.
Reduce bandwidth (especially important with mobile devices)
Reduce battery usage (again, important for mobile devices)
p
Write a function named count_vowels that accepts two arguments: a string and an empty dictionary. The function should count the number of times each vowel (the letters a, e, i, o, and u) appears in the string, and use the dictionary to store those counts. When the function ends, the dictionary should have exactly 5 elements. In each element, the key will be a vowel (lowercase) and the value will be the number of times the vowel appears in the string. For example, if the string argument is 'Now is the time', the function will store the following elements in the dictionary: 'a': 0 • 'e': 2 'i': 2 'o': 1 'u': 0 The function should not return a value.
The function that counts the number of times a vowel exist in a string is as follows:
def count_vowels(string, dictionary):
vowels = 'aeiou'
dictionary = {}.fromkeys(vowels, 0)
for i in string:
if i in vowels:
dictionary[i] += 1
return dictionary
print(count_vowels("trouble", {}))
Code explanation.The code is written in python.
we defined a function named "count_vowels". The function accept a string and an empty dictionary.Then. we store the vowels in a variable vowels.The dictionary is used to store the key value pair i.e the vowels and the number of times they appear.We looped through the string.If any value in the string is in vowels, we increase the dictionary values by 1.Then, we return the dictionary.Finally, we call the function with it parameters.learn more on function here: https://brainly.com/question/27219031
I of 60
MUL
FINISI
a
The view in which the field data types and field properties for a database table can be seen in Microsoft
Access is called the...
0.5 POINTS
A
00
Datasheet view
B
design view
с
D
SQL view
dashboard view
E
field view
The view in which the field data types and field properties for a database table can be seen in Microsoft Access is called the Datasheet view.
What is datasheet view?A datasheet form is known to be the view that shows a user the information recorded using a table.
Note that the properties of a field tells users the characteristics and attributes of data added to that field. A field's data type is therefore a vital property as it helps one to know the kind of data the field can save.
Learn more about database from
https://brainly.com/question/26096799
Two gamers are programming each player in a football team to throw a football
across the stadium at a specific speed to arrive at the running back's hand. Which is
the parameter and which is the argument in the code below?
The parameter and argument are the same, speed by 5 or 2
The parameter is speed, the argument is 5 or 2
The parameter is 5 or 2, the argument is speed
There are no parameters or arguments
The parameter and the argument in the code below is that the parameter is speed, the argument is 5 or 2.
Can programmers be said to be gamers?Gaming is known to be a kind of starting point for new set of programmers as a lot of game designers do uses different kinds of skills.
Note that in the above scenario, it the parameter is speed, the argument is needs to be 5 or 2 for it to work well.
Learn more about code from
https://brainly.com/question/25605883
Type the correct answer in the box. Spell all words correctly.
Craig has told his team to design a website, but he wants to see a fully laid out detailed version before functionality can be added. How can his team produce this?
Craig's team can demonstrate this by creating a(n) {----------}
.
Answer:
A project scope
Explanation:
I just took this on plato
The team designs the website according to the team leader by a project scope.
What is a website?The website is a set of web pages located under a single domain name, generated by a single person or any organization.
Craig has told his team to design a website, but he wants to see a fully laid out detailed version before functionality can be added.
A project can be introduced to create a website for the team members whether individually or in a team.
Thus, the team produce this by a project scope.
Learn more about website.
https://brainly.com/question/19459381
#SPJ2
6. What are the arguments, pros and cons, for Python's use of indentation to specify compound statements in control statements
Answer:
[tex]beinggreat78~here~to~help.[/tex]
In some cases, one con is that it can be hard to keep track of your identation when coding long lines or blocks. The pro is that you may need to learn, which is not a bad thing. Learning is good.
Mike logged into a shopping website and entered his username and password. Which protocol will the website use to verify his credentials?
Answer:
I think it is email or password
For each of the following agents, describe all the possible PEAS (Performance, Environment, Actuators, and Sensors) and then identify the environment type. Self-vacuum cleaner Speech recognition device Drone searching for a missing person Computer playing chess Alexa/Siri performing as a smart personal assistant.
The PEAS environment type is a task environment space that is used in the evaluation of performance, the environment, the sensors and the actuators.
How to identify the environment typeFor all of the options listed here, the environment types have to be put in tables. The table has been created in the attachment I added.
The use of PEAS helps in the performance of tasks in an independent way.
Read more on performance evaluator here: https://brainly.com/question/3835272
Write multiple if statements:
If carYear is before 1967, put "Probably has few safety features.\n" to output.
If after 1970, put "Probably has head rests.\n" to output.
If after 1992, put "Probably has anti-lock brakes.\n" to output.
If after 2002, put "Probably has airbags.\n" to output.
Ex: If carYear is 1995, then output is:
Probably has head rests.
Probably has anti-lock brakes.
Hope this is good enough! Good luck.
How many intrusion switches are there in Dell Precision Tower 7920?
The number of intrusion switches in Dell Precision Tower 7920 is one.
What is an intrusion switch?There is an chassis intrusion switch that is often used in the detection of any unauthorized access that is found stepping into the interior of one's system.
This kind of switch is known to be often activated quickly when the system cover is removed and access is done or made to the interior of one's system.
Learn more about intrusion switch from
https://brainly.com/question/24369537
Steps of booting a computer
A laser printer uses...........
A. Correction fluid
B. Ink cartridge
C. Photocopy ink
D. Toner cartridge
Answer:
Toner cartridge
Explanation:
Which line of code will use the overloaded division operation?
class num
definit__(self,a):
sell number = a
del_add___(self,b)
return self. number + 2 b.number
def__mul_(self, b)
return self.number + b.number
def_pow_(self, b):
return selt number + b number
def_truediv_(self,b);
return self number + 10 b.number
numA = num(5)
numB = num(10)
A.result = truediv(numA, numB)
B.result = numa/numB
C.result.truediv(numA, numB)
Answer:
B. result = numA/numB
Explanation:
__truediv__ overloads the / operator in Python. Since that has been defined in the class "num" and numA and numB are both objects of type "num" (numA / numB) will call num.__truediv__ using numA as "self" and numB as "b".
What service handles the execution of missed cron jobs in the /etc/cron.hourly, /etc/cron.daily, /etc/cron.weekly and cron.monthly files?
The service handles the execution of missed cron jobs is /etc/crontab.
Where are /etc/crontab is system crontabs file?This is a command that is often used by root user or daemons. It is used to configure system different kinds of jobs.
Vonclusively, Cron jobs are often seen in the spool directories. They are known to be often stored in tables known as crontabs. This /etc/crontab. is a service handles the execution of missed cron jobs.
Learn more about commands from
https://brainly.com/question/25243683