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

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

Answers

Answer : No sorry ..

Write a program that asks the user to enter an international dialing code and then looks it up in the country_codes array (see Sec 16.3 in C textbook). If it finds the code, the program should display the name of the corresponding country; if not, the program should print an error message. For demonstration purposes have at least 20 countries in your list.

Answers

Answer:

Explanation:

The following code is written in Python, it prompts the user for a country code, look it up and if found prints out the corresponding country name. If not it prints out an error message stating "Code not found"

country_codes = {"Argentina": 54, "Bangladesh": 880,

        "Brazil": 55, "Burma (Myanmar)": 95,

        "China": 86, "Colombia": 57,

        "Congo: Dem. Rep. of": 243, "Egypt": 20,

        "Ethiopia": 251, "France": 33,

        "Germany": 49, "India": 91,

        "Indonesia": 62, "Iran": 98,

        "Italy": 39, "Japan": 81,

        "Mexico": 52, "Nigeria": 234,

        "Pakistan": 92, "Philippines": 63,

        "Poland": 48, "Russia": 7,

        "South Africa": 27, "South Korea": 82,

        "Spain": 34, "Sudan": 249,

        "Thailand": 66, "Turkey": 90,

        "Ukraine": 380, "United Kingdom": 44,

        "United States": 1, "Vietnam": 84}

user_code = int(input("Enter Country code: "))

keys = list(country_codes.keys())

vals = list(country_codes.values())

if user_code in vals:

   print(keys[vals.index(user_code)])

else:

   print("Code not found")

This unit is used to print the picture on a paper

Answers

Answer:a printer

Explanation:

It prints things

jettison folk 2007, Magnum opus, be moving, offers poisoned commentary on the film industry.

Answers

Answer:

I'm a little confused...

Explanation:

Can you reword this please?

12. But not parallelism, it is achievable to have concurrency in operating system threading?

Answers

Answer:

Yes, it is possible to have concurrency but not parallelism. Concurrency: Concurrency means where two different tasks or threads start working together in an overlapped time period, however, it does not mean they run at same instant.

When someone refers to "space" on a computer or device, they are usually referring to _____, which allows the user to save a file for future use, even after the computer has been turned off. secondary storage the central processing unit (CPU) software primary memory

Answers

Answer:

it could either be the R.A.M or the hard drive

Explanation:

Answer:

Secondary Storage

Explanation:

Secondary storage is permanent, therefore, it fits the context of what the question is asking for.

my code get an input of 1900 and it should output not a leap year but it fails first line of code. It should output not a Leap any number with 1500 not divisble by 4 with/out a remainder should output (not a leap year. )


input_year = int(input())

if input_year % 4 == 0: #fails on this step, 1900 should be false
print(input_year, "- is Leap Year")

elif input_year % 100 == 0:
print(input_year, "- leap year")

elif input_year % 400 ==0:
print(input_year, "is a leap year")

else:
print(input_year, "- not a leap year")

Answers

Answer:

Explanation:

The code does not fail on the first step since 1900 divided by 4 is actually 475 and has no remainder, meaning that it should return True. The code won't work because the if statements need to be nested in a different format. The correct algorithm would be the following, which can also be seen in the picture attached below that if we input 1900 it would output is not a leap year as it fails on the division by 400 which gives a remainder of 0.75

input_year = int(input())

if input_year % 4 == 0:

   if input_year % 100 == 0:

       if input_year % 400 == 0:

           print(input_year, "is a leap year")

       else:

           print(input_year, "- not a leap year")

   else:

       print(input_year, "is a leap year")

else:

   print(input_year, "- not a leap year")

briefly explain 5 software which is either free or fee​

Answers

Answer:

65

Explanation:

Answer:

65

Explanation:

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:

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

Which examples demonstrate common qualifications for Marketing Information Management and Research careers? Check all that apply.

David has the physical strength to lift products on high shelves.
Alessandra analyzes and interprets information she gathered from surveys.
Eve is good at presenting and explaining information to others.
Franklin is a strong leader who is able to motivate others.
Gene is very organized and tracks information accurately and carefully.
Claire is confident and persuasive, which makes her good at selling products.

Answers

Answer:

2,3,5

Explanation:

Answer: the answer is 2 3 and 5

Explanation:

6
Suppose the following formula is inputted into Excel:
=MROUND(1/4,100)
The output in the cell will be:
0
0.25
0.2500
1

Answers

Answer:

the output in the cell will be 0,2500

What is the name for the part of a camera which can block light when it's closed, and let light in when it's open?


Pixel


Lens


Focus


Shutter

Answers

dnt listen to the link stuff

Basic python coding, What is the output of this program? Assume the user enters 2, 5, and 10.
numA = 0
for count in range(3):
answer = input ("Enter a number: ")
fltAnswer = float(answer)
numA = numA + fltAnswer
print (numA)
Thanks in advance!
:L

Answers

Answer:

17.0

Explanation:

I ran it for you. You could also try that (go to replit).

Can two computers be assigned to one IP address

Answers

Answer:

two computers cannot have the same public (external) IP address unless they are connected via the same router. If they are connected via the same router, then they can have (share) the same public IP address yet have different private (local) IP addresses

Explanation:

Answer: maybe

Explanations: two computers cannot have the same public (external) IP address unless they are connected via the same router. If they are connected via the same router, then they can have (share) the same public IP address yet have different private (local) IP addresses.

A user has a computer with a single SSD, and the entire drive contains one partition. The user wants to install a second OS on the computer without having to reinstall the current OS. The user wants to be able to select which OS to use when booting the computer. Which Disk Management tools should the user utilize to accomplish this task?

Answers

Answer:

The correct approach is "Shrink partition". A further explanation is given below.

Explanation:

Shrinking partition shrinks or decreases this same disc size as well as unallotted disc space, unallotted space could be utilized to mount a secondary Operating system to operate as a double operating system.Whilst also diminishing everything into neighboring volatile memory on another disc, this same space required for area as well as drives could also be reduced.

Thus the above is the correct answer.

wassup anybody tryna play 2k

Answers

Answer:

u dont want the smoke my boy u dont

Explanation:

Answer:

I only play 24k B)))))))))

Three reasons Why we connect speakers to computers

Answers

1. Some computers do not have speaker therefore we connect speakers

2. Some speakers don’t have clear audio so to fix that we connect new ones

3. What do you do if your speaker inside the computer is broken..... connect new speakers

Answer:

we connected speakers with computers for listening voices or sound .. because the computer has not their own speaker..

Explanation:

While all pages use HTML code, not all pages are written in

Answers

Is this a question?

*Answer: not much information to answer with*

Answer:

Code Form

Explanation:

Suppose Alice downloads a buggy browser that implements TLS incorrectly. The TLS specification says that, during the handshake, the browser should send a random 256-bit number RB. Instead of picking RB randomly the browser always sends all zeros. Describe an attack that is possible against this buggy browser and how to update the browser so that this attack is no longer feasible.

Answers

Solution :

It is given that Alice downloads the buggy browser which implements a TLS incorrectly. The specification of a TLS states that during a handshake, the browser sends a 256 bit number of RB randomly.

So in this case, a man-n-the-middle attack is possible. It can compromise the confidentiality of Alice. Updating the browser by visiting the website and checking its latest version of the browser or installing some other browser which has a more trust in the market for its security features.

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.

how does such editing affect courtrooms where visual evidence is often presented?​

Answers

Can hurt others..!! yw

Programming a computer to win at chess
has been discussed since the
A. 1940's
B. 1950's
C. 1960's

Answers

I believe it was the 1960s but u should seach it up to double check

Answer:

B.

Explanation:

State the causes of the increase in carbondioxide
concerntration​

Answers

Answer:

The right response is "fossil fuels".

Explanation:

Fossil fuels such as coal as well as oil conduct electricity that has already been photosynthesized by vegetation or plant species from the ecosystem for thousands of generations.Within only several hundred years we've returned fuel to that same ecosystem or environment, the sources of CO₂ rise are fossil fuels.

However, the above solution is the right one.

What is the proper order for the fetch-execute cycle?

Answers

Control Unit – controls all parts of the computer system. It manages the four basic operations of the Fetch Execute Cycle as follows:

Fetch – gets the next program command from the computer’s memory

Decode – deciphers what the program is telling the computer to do

Execute – carries out the requested action

Store – saves the results to a Register or Memory

Arithmetic Logic Unit (ALU) – performs arithmetic and logical operations

Register – saves the most frequently used instructions and data

Number the steps to describe how Tristan can complete
this task.
Cut the Television and related equipment row.
Paste the Television and related equipment row.
Click the plus sign on the left side of the table between
the last two rows.

Answers

Answer:

Cut the Television and related equipment row.Click the plus sign on the left side of the table between  the last two rows.Paste the Television and related equipment row.

Explanation:

In order to move the row, Tristan should first select the row and then cut it. This will ensure that the row will be moved completely instead of copied.

Tristan should then hover with the mouse between the last two rows and click on the plus sign on the left side. It will add a new row to the sheet. between the last two rows.

Tristan should then select the topmost cell and click paste. The television row will be pasted there and Tristan would have successfully moved it.

Answer:

2 3 1 Your Welcome

Explanation:

find four
reasons
Why must shutdown the system following the normal sequence

Answers

If you have a problem with a server and you want to bring the system down so that you could then reseat the card before restarting it, you can use this command, it will shut down the system in an orderly manner.

"init 0" command completely shuts down the system in an order manner

init is the first process to start when a computer boots up and keep running until the system ends. It is the root of all other processes.

İnit command is used in different runlevels, which extend from 0 through 6. "init 0" is used to halt the system, basically init 0

shuts down the system before safely turning power off.

stops system services and daemons.

terminates all running processes.

Unmounts all file systems.

Learn more about  server on:

https://brainly.com/question/29888289

#SPJ1

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:

What are
the rules for giving
variable name ?​

Answers

Answer:

Rules for naming variables:

- Variable names in Visual C++ can range from 1 to 255 characters. To make variable names portable to other environments stay within a 1 to 31 character range.

- All variable names must begin with a letter of the alphabet or an underscore ( _ ).  For beginning programmers, it may be easier to begin all variable names with a letter of the alphabet.

- After the first initial letter, variable names can also contain letters and numbers.  No spaces or special characters, however, are allowed.

- Uppercase characters are distinct from lowercase characters.  Using all uppercase letters is used primarily to identify constant variables.  

- You cannot use a C++ keyword (reserved word) as a variable name.

Explain what an IM is,

Answers

Answer: Stands for "Instant Message." Instant messaging, or "IMing," as frequent users call it, has become a popular way to communicate over the Internet

Explanation:

Other Questions
help pls first awnser get brainest The Consumption of quinoa has been on the rise in an economy. A grain called teff has been referred to as quinoa's twin and is often consumed in place of quinoa. This would make teff and quinoa ___________,and an increase in the price of quinoa should ____________the demand for teff, ceteris paribus. O complements: increase O complements; decrease. O substitutes; increase O substitutes; decrease : Crop researchers are interested in the productivity of a new variety of corn. They plant 30 plots with randomly selected seeds of the new variety, record the yield in bushels per acre, and find that a 95% confidence interval for the true mean yield is 125 to 140 bushels per acre. (a) Interpret the confidence interval. (3 points) (b) What is the point estimate that was used to create the interval? What is the margin of error? (2 points) (c) Interpret the confidence level. (3 points) (d) Based on the research, a marketer tells a possible customer that with this new variety of corn they can expect to receive more than 125 bushels per acre, on average. Use the confidence interval to evaluate this statement. (3 points) Read the passage from The American Plague. Whenever the Parliament clashed with their monarch, the king would get his way by suddenly convening Parliament in a remote, unreachable part of the country. Without a proper quorum of members, the king could then decide law as he pleased. As a result, representatives in the United States had drawn up the Constitution with particular attention to the issue of where they would meet in the future. The best reason why the last sentence is an effect is because it defines You have just tumed 30 years old, have just received your MBA, and have accepted your first job. Now you must decide how much money to put into your retrement plan. You are required to specify a food percentage of your salary that you want to contribute. Assume that your starting salary is $75,000 per year and it will grow 2% per year until you retire. Every dollar in the plan earns 7% per year. You cannot make withdrawals until you retire on your sixty-fifth birthday. After that point, you can make withdrawals as you see ft. You decide that you wil plan to live to 100 and work until you turn 65. You estimate that to live comfortably in retirement, you will need $100,000 per year starting at the end of the first year of retirement and ending on your 100th birthday. What percentage of your income do you need to contribute to the plan every year to fund your retirement income? The fraction of your salary that you should save is Round to two decimal places) Which element is found in primary-source historical documents?criticism of how the event was handledanalysis of the historical events describeda firsthand view of the time period Aubrey has a new art box in the shape of a rectangular prism. The box is 12\text{ cm}12 cm12, start text, space, c, m, end text by 20\text{ cm}20 cm20, start text, space, c, m, end text by 5\text{ cm}5 cm5, start text, space, c, m, end text. The only thing in the art box is a new pink eraser with the dimensions shown below. how do you add an equation vertically given the following information is the variance favorable or unfavorable? flexible budget sales $100,000 actual sales $95,000a. favorableb. unfavorable Match the following terms and definitions. 1. an electrical nerve impulse sent by nerve fibers to the central nervous system for interpretation chemoreceptors 2. neurons that detect chemicals such as those found in food effector 3. type of eyes many arthropods have; eyes that protrude outward and consist of many lenses electroreceptors 4. the structure that gives the response to an environmental change compound eyes 5. neurons that detect electrical fields action potential 6. secretion of hormones into the blood stream to affect distant processes endocrine HELP ME I NEED THIS DONE ASAP I DON'T HAVE TIME TO COMPLETE IT50 points for whoever can do this. thanks! :)(why is no one helping me??? Please!) The need to establish planning materiality is directly relatedto the audit objective of obtaining reasonable assurance ofdetecting misstatements that could be large enough, individually orin the ag Tell the story of [your first day of school], following this rule: each sentence begins with the last letter of the previous sentence. International anti-competitive conduct that would be a violation if it occurred in the U.S., and that affects imports into the U.S., is considered a violation of U.S. law. True /False? PLS HELPPP GEOMETRY!!!!!!You are on a fishing boat that leaves its pier and heads east. After traveling for 24 miles, there is a report warning of rough seas directly south. The captain turns the boat and follows a bearing of S45W for 13.4 miles.a. At this time, how far are you from the boat's pier?b. What bearing could the boat have originally taken to arrive at this spot? _________________ is a technique that involves writing about the research process from beginning to end. How could these sites be useful in countries where the government censors the news? se desea constrir una barda utilizando block . las dimensiones de la barda son 25 m de largo y 2 m de altura . si se requieren 12 blocks para cada metro cuadrado de barda cuantos blocks se usaran en su construccin? respuesta urgente !!! Identified risks can be: *a. Deflected via contracting.b. Handled via reserves.c. Ignored, since they cannot be identified.d. Aand B There is a series of nitrogen oxides with the general formula N?O?. What is the empirical formula of one that contains 63.66% nitrogen?