At the beginning of the semester, we studied partially filled arrays. This is when the number of elements stored may be less than the maximum number of elements allowed. There are two different ways to keep track of partially filled arrays: 1) use a variable for the numberElements or 2) use a sentinel (terminating} value at the end of elements (remember c-strings?). In the code below, please fill in the details for reading the values into the an array that uses a sentinel value of -1. Complete the showArray function as well.
#include
using namespace std;
void showArray(int array[]);
// ToDo: Code showArray function with one array parameter
int main()
{
const int MAX_SIZE=16;
int array[MAX_SIZE]; // store positive values, using -1 to end the values.
cout <<"Enter up to " << MAX_SIZE-1 << " positive whole numbers, use -1 to stop\n";
//To do: Read the int values and save them in the static array variable.
// When the user enters -1 or the array has no more room, leave the loop..
//To do: store -1 at the end of elements in the array
// Show array function
showArray(array);
return 0;
}
// To do: print out for the array
void showArray(int array[])
{
}

Answers

Answer 1

Answer:

Complete the main as follows:

int num;

cin>>num;

int i = 0;

while(num!=-1 && i <16){

array[i] = num;

cin>>num;

i++;  }

array[i+1] = -1;

The showArray() as follows:

int i =0;

while(array[i]!=0){

   cout<<array[i]<<" ";

   i++;

}

Explanation:

See attachment for complete program where comments are used to explain difficult lines


Related Questions

Question 5/20
00:07:27
Agile Teams need to comply by the Agile Values and Principles but have flexibility to choose appropriate value-adding practices
Select the correct option(s) and click Submit.
True
False
SUBMIT

Answers

Explanation:

True. Is the true answer

c program that calculates the summation of integers from one to N. Allow the user to input an integer, then pass that number to a function that will calculate the sum of all integers up to N. For example, if the user inputs the number 5, then the function will return the sum 1 2 3 4 5. Allow the user to enter multiple integers, calling the function for each number. Use a sentinel value or similar method to terminate user input.

Answers

Answer:

Answered below.

Explanation:

#include <studio.h>

#include<conio.h>

void main(){

int I = 0;

int sumOfNumbers = 0;

int number;

printf("Input an integer: ");

("%d", &sumOfNumbers);

//Loop over while adding numbers

while(I <= number){

sumOfNumbers = sumOfNumbers + I;

I++;

}

printf("\n Sum of N numbers is: %d", sumOfNumbers);

getch();

}

Which database item would show details such as a customer’s name, their last purchase, and other details about a customer?
A. file
B. field
C. record
D. table
E. index

Answers

The correct answer would be C. Record

Answer:

The answer is C. Record

Explanation:

Christopher was looking at the TV while getting feedback on his opinion essay. What should he do differently? Don't get feedback from a trusted adult. Finish watching his TV show. Make sure the trusted adult likes the show on TV, too. Turn off the TV and face the person who is speaking.

Answers

Answer:

Turn off the TV and face the person who is speaking.

mips Write a program that asks the user for an integer between 0 and 100 that represents a number of cents. Convert that number of cents to the equivalent number of quarters, dimes, nickels, and pennies. Then output the maximum number of quarters that will fit the amount, then the maximum number of dimes that will fit into what then remains, and so on. If the amount entered is negative, write an error message and quit. Amounts greater than 100 are OK (the user will get many quarters.) Use extended assembly instructions and exception handler services.

Answers

Answer:

Explanation:

The following code is written in python and divides the amount of cents enterred in as an input into the correct amount of quarters, dimes, nickels and pennies. Finally, printing out all the values.

import math

#First we need to define the value of each coin

penny = 1

nickel = 5

dime = 10

quarter = 25

#Here we define the variables to hold the max number of each coin

quarters = 0

dimes = 0

nickels = 0

pennys = 0

cents = int(input("Please enter an amount of money you have in cents: "))

if cents > 0 and cents <= 100:

   if cents >= 25:

       quarters = cents / quarter

       cents = cents % quarter

   if cents >= 10:

       dimes = cents/dime

       cents = cents % dime

   if cents >= 5:

       nickels = cents /nickel

       cents = cents % nickel

   if cents > 0:

       pennys = cents / penny

       cents = 0

   print("The coins are: "

       "\nQuarters", math.floor(quarters),

       "\nDimes", math.floor(dimes), "\nNickels", math.floor(nickels), "\nPennies", math.floor(pennys))

else:

   print("wrong value")

A student repeated the Styrofoam ball experiment. This time, the student rubbed the plastic rod on the cat's fur, but also rubbed the Styrofoam ball on the fur. How would the outcome of the investigation change if both objects were rubbed on the cat's fur? Use evidence and scientific reasoning to support your answer. Be sure to describe the charges and field interactions for both objects.

Answers

Answer:

Electrostatically charged rods. When you rub the plastic rod (polyethylene terephthalate, glycol modified, or PETG) with the wool cloth, the rod charges negative. When you rub the glass rod with the silk, the rod charges positive. ... The Coulomb, the unit of electrostatic charge, is named after him.

Explanation: i think

Answer:Electrostatically charged rods. When you rub the plastic rod (polyethylene terephthalate, glycol modified, or PETG) with the wool cloth, the rod charges negative. When you rub the glass rod with the silk, the rod charges positive. ... The Coulomb, the unit of electrostatic charge, is named after him.

Explanation:Electrostatically charged rods. When you rub the plastic rod (polyethylene terephthalate, glycol modified, or PETG) with the wool cloth, the rod charges negative. When you rub the glass rod with the silk, the rod charges positive. ... The Coulomb, the unit of electrostatic charge, is named after him.

Given a number count the total number of digits in a number

Answers

Answer:

round up the log of the number

Explanation:

The ¹⁰log of a number gives you the number of digits if you round it up.

What are input masks most useful for in data validation? moving data from one field to another hiding parts of a value that are unnecessary identifying duplicate values in different records in a table ensuring consistent formatting of values in a specific field

Answers

Answer:

Ensuring Consistent Formatting of Values in a Specific Field

Explanation:

Answer: ensuring consistent formatting of values in a specific field

Explanation: on edg

how do i work this out? does anyone do programming?

Answers

Answer : No sorry ..

Explain why microcomputers are installed with TCP/IP protocols?​

Answers

Answer:

microcomputers are installed with TCP/IP protocols because its a set of standardized rule that allows the computer to communicate on a network such as the internet

what is work immersion and its nature​

Answers

Work Immersion refers to the subject of the Senior High School Curriculum, which involves hands-on experience or work simulation in which learners can apply their competencies and acquired knowledge relevant to their track.

Describe how data is shared by functions in a procedure- oriented program​

Answers

In procedure oriented program many important data items are placed as global so that they can access by all the functions. Each function may have its own local data. Global data are more vulnerable to an inadvertent change by a function.

HELP ASAP DONT ANSWER WITH A LINK​

Answers

Answer:

Layout

title

title and content

section header

comparison

Orientation

landscape

portrait

Scrabble is a word game in which words are constructed from letter tiles, each letter tile containing a point value. The value of a word is the sum of each tile's points added to any points provided by the word's placement on the game board. Write a program using the given dictionary of letters and point values that takes a word as input and outputs the base total value of the word (before being put onto a board). Ex: If the input is: PYTHON the output is: 14

Answers

Complete question:

Scrabble is a word game in which words are constructed from letter tiles, each letter tile containing a point value. The value of a word is the sum of each tile's points added to any points provided by the word's placement on the game board. Write a program using the given dictionary of letters and point values that takes a word as input and outputs the base total value of the word (before being put onto a board). Ex:  If the input is:  PYTHON

the output is: 14

part of the code:

tile_dict = { 'A': 1, 'B': 3, 'C': 3, 'D': 2, 'E': 1, 'F': 4, 'G': 2, 'H': 4, 'I': 1, 'J': 8,  'K': 5, 'L': 1, 'M': 3, 'N': 1, 'O': 1, 'P': 3, 'Q': 10, 'R': 1, 'S': 1, 'T': 1,  'U': 1, 'V': 4, 'W': 4, 'X': 8, 'Y': 4, 'Z': 10 }

Answer:

Complete the program as thus:

word = input("Word: ").upper()

points = 0

for i in range(len(word)):

   for key, value in tile_dict.items():

       if key == word[i]:

           points+=value

           break

print("Points: "+str(points))

Explanation:

This gets input from the user in capital letters

word = input("Word: ").upper()

This initializes the number of points to 0

points = 0

This iterates through the letters of the input word

for i in range(len(word)):

For every letter, this iterates through the dictionary

   for key, value in tile_dict.items():

This locates each letters

       if key == word[i]:

This adds the point

           points+=value

The inner loop is exited

           break

This prints the total points

print("Points: "+str(points))

Answer:

Here is the exact code, especially if you want it as Zybooks requires

Explanation:

word = input("").upper()

points = 0

for i in range(len(word)):

  for key, value in tile_dict.items():

      if key == word[i]:

          points+=value

          break

print(""+str(points))

If not cleared out, log files can eventually consume a large amount of data, sometimes filling a drive to its capacity. If the log files are on the same partition as the operating system, this could potentially bring down a Linux computer. What directories (or mount points) SHOULD be configured on its own partition to prevent this from happening?

Answers

Answer:

/var

Explanation:

The /var subdirectory contains files to which the system writes data during the course of its operation. Hence, since it serves as a system directory, it would prevent log files from consuming a large amount of data.

Answer:

/var

Explanation:

Hope this helps

Write a program that asks for the user's name, phone number, and address. The program then saves/write all information in a data file (each information in one line) named list.txt. Finally, the program reads the information from the file and displays it on the screen in the following format: Name: User's Name Phone Number: User's Phone Number Address: User's Street Address User's City, State, and Zip Code g

Answers

Answer:

Amazon prime

Explanation:

In a multimedia presentation, when might voice-over be a better choice than placing the text on the screen?
when you have very little to say
when your audience is bored
when you have a lot to say
when you don’t want to write

Answers

Um, it is quite the battle between C and D, but knowing school they probably think D is lazy, so my final answer is C. Sorry if I'm wrong <3

In a multimedia presentation, the option that might be the voice-over  when you have a lot to say.

What is multimedia presentation?

A multimedia presentation is known to be a presentation where a person is said to often stand by themselves to present information via slides, video, etc.

In a multimedia presentation, the option that might be in the case of voice-over is when you have a lot to say as it is better to put it in a video format.

Learn more about multimedia from

https://brainly.com/question/24138353

#SPJ2

What are some of the strategies that you use for confronting a complex problem and breaking it down into smaller pieces? How might some of these strategies be useful to a computer programmer working on a CPU scheduler?

Answers

Answer:

Breaking it down I guess for me, you could take down all the possible things that you could do. Eliminating things, one by one. It could help working on a computer by not letting yourself get over-whelmed by all your programming and thinking "alright, this THEN this."

Explanation:

The strategies that you use for confronting a complex problem are:

First, define the issue.Use your inner eyes to visualize the issue. Break the problem into little pieces

Why are problem-solving strategies vital?

Solving problems involves the act of making the right choices. It is known to be a good and  effective way of problem-solving as one can get a good result from it.

Conclusively, by using the strategies give above, a computer programmer working on a CPU scheduler can be able to find out the issues that needs to be handled, where the problem is coming from and then solve it.

Learn more about CPU from

https://brainly.com/question/474553

Write a function, AvgList, that takes a single argument, a list, and returns the average (mean) of the numbers in the list. You may assume that all elements of the list are numeric (int or float), and that the list has at least one element. Hints: Use the function SumList that you wrote above. Use the built-in function len to get the number of elements in the list.

Answers

Answer:

Answered below

Explanation:

//Programmed in Java

public double avgList(int [] nums){

int I;

double sumOfNumbers = 0;

double averageOfNumbers = 0;

//Loop over to sum all elements in the list.

for(I = 0; I < nums.length; I++){

sumOfNumbers += nums[I];

}

//Calculate the average

averageOfNumbers = sumOfNumbers/ nums.length;

return averageOfNumbers;

}

The following question is based on the following incomplete declaration of the class BoundedIntArray and its constructor definitions.

A BoundedintArray represents an indexed list of integers. In a BoundedIntArray the user can specify a size, in which case the indices range from 0 to size - 1. The user can also specify the lowest index, low, in which case the indices can range from low to low + size - 1.

public class BoundedIntArray
{

private int[] myItems; // storage for the list
private int myLowIndex; // lowest index
public BoundedIntArray(int size)
{

myItems = new int[size];
myLowIndex = 0;
}
public BoundedIntArray(int size, int low)
{
myItems = new int[size];
myLowIndex = low;
}
// other methods not shown
}
Consider the following statements.

BoundedIntArray arrl = new BoundedIntArray(100, 5);
BoundedIntArray arr2 = new BoundedIntArray(100);
Which of the following best describes arrl and arr2 after these statements?

a.
arrl and arr2 both represent lists of integers indexed from 0 to 99.
arrl and arr2 both represent lists of integers indexed from 0 to 99 . ,

b.
arrl and arr2 both represent lists of integers indexed from 5 to 104.
arrl , and, arr2 , , both represent lists of integers indexed from, 5 , to, 104, .,

c.
arrl represents a list of integers indexed from 0 to 104, and arr2 represents a list of integers indexed from 0 to 99.
arrl , represents a list of integers indexed from, 0 , to, 104, , and, arr2 , represents a list of integers indexed from, 0 , to, 99, ., ,

d.
arrl represents a list of integers indexed from 5 to 99, and arr2 represents a list of integers indexed from 0 to 99.
arrl represents a list of integers indexed from 5 to 99 , and arr2 represents a list of integers indexed from 0 to 99 . ,

Answers

Answer:

d.

Explanation:

Using the Java code provided, the creation of the BoundedIntArray objects would be that arrl represents a list of integers indexed from 5 to 99, and arr2 represents a list of integers indexed from 0 to 99. This is because arr1 is passing two arguments when it is being created, the first indicates the array size while the second indicates the lowest index. Since it passes two arguments it overrides the constructor and uses the constructor with two parameters. arr2 only passes one argument so it uses the original constructor which automatically sets the lowest index to 0.

The correct choice in this question is "arr1 is an array of numbers indexed from 5 to 104, while arr2 is an array of integers indexed from 0 to 99".

Array number:

arr1 is for numbers 5 to 104, whereas arr2 is for numbers 0 to 99.Since the lowest index in arr1 is transmitted, it should be 5, and the array size should be 100. The index of the last member inside an array is also (size-1) since the array's lowest index is inclusive.Furthermore, arr2 is for 0 to 99, so because size, which would be 100, if passed, the lowest index is not. As a result, the lowest index by default is 0.

Find out more about the Array here:

brainly.com/question/13107940

What are the vertical areas of the spreadsheet?

a
Verticies
b
Ventricals
c
Columns
d
Rows

Answers

Answer:

Columns

Explanation:

A spreadsheet may a explained as a tabular arrangement or arrays of cells which allows users to enter both numeric and string data for storage, manipulation and analysis. The spreadsheet program has both the vertical and horizontal cell arrangement with the vertical areas being reffered to as THE COLUMN which are labeled using alphabets arranged from A - AZ, AA - AZ, and so on to make up a total of 16384 columns on the Microsoft Excel spreadsheet program. Cells are located using a combination of column and row address. With row representing the horizontal area of the spreadsheet and labeled with digits. Therefore cells are usually refereed to as A1, (column A row 1) and so on.

Which factor distinguishes IOT devices from standard computing devices such as laptops and smart phones?

Answers

Answer:

PLS help me I'm tried

Haa plsssssss

....................

Answers

Answer:

*

* *

* * *

* * * *

* * * * *

i did it i guess?

Which step should you follow to copy a worksheet after clicking Format in the Cells group?
O Under Arrange Sheets, click Cut or Copy Sheet.
O Under Organize Sheets, click Move or Copy Sheet.
O Under Arrange Sheets, click Select and Move Sheet.
O Under Organize Sheets, click Arrange and Copy Sheet.

Answers

Answer:

Under Organize Sheets, click Move or Copy Sheet should you follow to copy a worksheet after clicking Format in the Cells group.

Explanation:

Joseph wants to take out the color of the background wall from an image what can Joseph do to achieve this​

Answers

Answer:

Go to remove a background website

Explanation:

He can download an application IbisPaint X, use the magic wand tool and select the background and then press the outlined square and select the option clear layer

In order to implement the classic DoS flood attack, the attacker must generate a sufficiently large volume of packets to exceed the capacity of the link to the target organization. Consider an attack using ICMP echo request (ping) packets that are 500 bytes in size (ignoring framing overhead). How many of these packets per second must the attacker send to flood a target organization using a 0.5-Mbps link

Answers

Answer:

131 packets

Explanation:

Given

W (link ) =0.5 M bits,  and Ping packets ( P ) = 500bytes

To flood a target organization that has a bandwidth of W bits using a packet Mbits, you will require a W / P packet

P ( required ) = 500  * 8 = 4000 bits

therefore the W /P packet is calculated as

= 0.5 M bits / 4000 bits

given that :  1 M bits =  1,048,576 bits

0.5 M bits / 4000 bits=  131.07  

hence approximately 131 packets/ sec is required to flood the target organization

what does ICT stand for?​

Answers

Information Communication Technology

ICT stands for 'Information Communication Technology'. Everyday usage of digital technology includes when you use a computer, tablet or mobile phone, send email, browse the internet, make a video call - these are all examples of using basic ICT skills and technology to communicate.

Information Communication Technology

You work for a small company that exports artisan chocolate. Although you measure your products in kilograms, you often get orders in both pounds and ounces. You have decided that rather than have to look up conversions all the time, you could use Python code to take inputs to make conversions between the different units of measurement.
You will write three blocks of code. The first will convert kilograms to pounds and ounces. The second will convert pounds to kilograms and ounces. The third will convert ounces to kilograms and pounds.
The conversions are as follows:
1 kilogram = 35.274 ounces
1 kilogram = 2.20462 pounds
1 pound = 0.453592 kilograms
1 pound = 16 ounces
1 ounce = 0.0283 kilograms
1 ounce = 0.0625 pounds
For the purposes of this activity the template for a function has been provided. You have not yet covered functions in the course, but they are a way of reusing code. Like a Python script, a function can have zero or more parameters. In the code window you will see three functions defined as def convert_kg(value):, def convert_pounds(value):, and def convert_ounces(value):. Each function will have a block showing you where to place your code.

Answers

Answer:

Answered below.

Explanation:

def convert_kg(value){

ounces = value * 35.274

pounds = value * 2.20462

print("Kilograms to ounces: $ounces")

print("Kilograms to pounds: $pounds)

}

def convert_pounds(value){

kg = value * 0.453592

ounce = value * 16

print("pounds to kg; $kg")

print ("pounds to ounce; $ounce")

}

def convert_ounces(value){

kg = value * 0.0283

pounds = value * 0.0625

print ("ounces to kg; $kg")

print ("ounces to pounds; $pounds")

}

A client is

a computer that is disconnected from the network.

the same as a server.

a computer that requests a service.

a router.

Answers

Answer:

a computer that requests a service.

Answer:

A computer that requests a service

Explanation:

In computing, a client is a piece of computer hardware or software that accesses a service made available by a server as part of the client–server model of computer networks. The server is often (but not always) on another computer system, in which case the client accesses the service by way of a network.

plz mark as brainliest

What type of information is best suited for infographies?​

Answers

Answer:

All varieties of information, from bullet pointed text to numerical tables

Explanation:

Answer:

All varieties of information, from bullet pointed text to numerical tables

Explanation:

Other Questions
An object, with mass 64 kg and speed 14 m/s relative to an observer, explodes into two pieces, one 2 times as massive as the other; the explosion takes place in deep space. The less massive piece stops relative to the observer. How much kinetic energy is added to the system during the explosion, as measured in the observer's reference frame What is the pH of a 1.0 x 10-2 M HNO3 solution? 1. Think of someone who has had a significant impact on you, for better or worse. Describe how this person has communicated with you and how their messages have influenced your self-concept and self-worth. I Please help!look at photo to answer!!! In a poll, students were asked to choose which of six colors was their favorite. The circle graph shows how the students answered. If 10000 students participated in the poll, how many chose Orange? a 4.5 Hz wave has a wavelength of 0.8m. what is the speed0.18 m/s5.6m/s5.3m/s 3.6m/s 3. All pedestrians understand the distance required for a motor vehicle to stop.A. O TrueB. O False The student identified acharacter.plot.theme.topic. Por qu la batalla de Stalingrado fue tan decisiva para el curso de la guerra? how do scientists use models to determine the scale properties of objects in our solar system Aluminum is used to make cookware and cans. It is alsoused to make vehicles, medicine, machinery, and evendeodorantAccording to the graph, which industry uses the most aluminum?O A. TransportationO B. Buildingc. PackagingD. Machinery Combine the like terms to create an equivalent expression for n+(4)(4n)+6 The question is in the picture. 1-How did the Second World War shift the focus of the global story you've learned so far? help me pls i am confused lol How would you conjugate the verb deber in the following sentence? Fill in the blank. (Only enter the missing word and not the entire sentence. Entering the entire sentence will be marked incorrectly.)Usted _________ ir al mdico para medicina. As part of his science project, Steve recorded the number of eggs laid by several lizards from the local pet shop. The data Steve collected is provided below.10, 7, 8, 8, 9, 10, 9, 10, 8, 11, 11, 9, 7, 10, 9In his report, Steve should use the _____ as a measure of center since his data is ____ The ratio of girls to boys in a grade is 6 to 5. If there are 24 girls in the grade, how many students are there altogether? Which of the following terms describes the writer's attitude toward his or her subject? (1 point)O toneOmeaningO connotationOexperience Digestive enzymes in your stomach and intestines help digest the food you eat. If you are lactose intolerant and cannot digest milk products, it is the result of a mutated message in your...Group of answer choiceslysosomesnucleoluschromosomesX and Y chromosome