1answer.
Ask question
Login Signup
Ask question
All categories
  • English
  • Mathematics
  • Social Studies
  • Business
  • History
  • Health
  • Geography
  • Biology
  • Physics
  • Chemistry
  • Computers and Technology
  • Arts
  • World Languages
  • Spanish
  • French
  • German
  • Advanced Placement (AP)
  • SAT
  • Medicine
  • Law
  • Engineering
adoni [48]
3 years ago
6

For the function definition int SomeFunc( /* in */ int alpha, /* in */ int beta ) { int gamma; alpha = alpha + beta; gamma = 2 *

alpha; return gamma; } what is the function postcondition?
Computers and Technology
2 answers:
Sonbull [250]3 years ago
3 0

Answer:

A function post-condition refers to what will happen  and return after calling the function.

Given the function definition as follows:

  1. int SomeFunc( /* in */ int alpha, /* in */ int beta )
  2. {
  3.    int gamma;
  4.    alpha = alpha + beta;
  5.    gamma = 2 * alpha;
  6.    return gamma;
  7. }

If we call the function by passing two values, 3 and 4, as input parameters, the 3 will be captured by alpha and 4 by beta. The two input values will by calculated based on the formula defined inside the function as follows:

alpha = 3 + 4 = 7

gamma = 2 * 7 = 14

At last the function will return 14.

lbvjy [14]3 years ago
3 0

Answer:

function value == 2*([email protected] + [email protected])

Explanation:

int SomeFunc( /*in */ int alpha,  /* in */ int beta )

{

int gamma;

alpha = alpha + beta;

gamma = 2 * alpha;

return gamma;

}

The post-condition is useful for testing purposes. It represents what value the function SomFunc is expected to return at the time of program execution in a simplified manner.

For the given problem the post-condition is

function value == 2*([email protected] + [email protected])

Where @entry represents the value of alpha and beta at the moment when the function was called.

Note:  /*in */  it represents comment in c++ language and is ignored by the compiler

You might be interested in
What are the steps for consolidating data from multiple worksheets? 1. Select the range of data on the first worksheet you wish
likoan [24]

Answer:

2. Go to the Data tab on the ribbon and select Data Tools.

3. Then, select and the dialog box will appear.

4. Choose the in the drop-down. Then, select the first group of data and press Enter.

1. Select the range of data on the first worksheet you wish to consolidate.

5. To add from more worksheets, select from the View tab.

Explanation:

Consolidation in Microsoft Excel is used to gather information from several worksheets. To consolidate data in a new worksheet, select the new worksheet and click on the upper left side where the data should be.

Click on Data > Consolidate, then a dialog box would appear. From the dialog box click on the function to consolidate with, then click on the reference area and select the first data range by clicking on the first worksheet and drag the data range to the box and click Add.

To add more data range, click on the reference area and do the same as the first data.

7 0
3 years ago
Read 2 more answers
Define an array of the length 6 with the elements of WORD type. Initialize the first and the last of them with the same value of
Llana [10]

Answer:

string words[6];

words[0]="humming";

words[1]=words[0];

Explanation:

The above statement declares an array of size 6 which can store elements of type string or word. Then I have initialized the first and second elements with the word humming and the rest of the places in the arrays are uninitialized.

You have to include the header file string so that this array could work otherwise it will not.

6 0
3 years ago
Write an application that allows a user to select a country from a list box that contains the following seven options. After the
hodyreva [135]

Answer:

Programming Language not stated;

But this application definitely requires a graphical user interface platform (so, I'll use Microsoft Visual C# - Winforms).

Controls to be used are.

1. Form

2. List box

I'll name the Form, Form1 and the list box, listbox1.

Explanation:

The code goes thus;

private void Form1_Load(object sender, System.EventArgs e)

{

//Load country into empty listbox

listbox1.Items.Add("Austria");

listbox1.Items.Add("Canada");

listbox1.Items.Add("England");

listbox1.Items.Add("France");

listbox1.Items.Add("Italy");

listbox1.Items.Add("Mexico");

listbox1.Items.Add("Spain");

}

private void listbox1_SelectedIndexChanged(object sender, System.EventArgs e)

{

//Check if an item is really selected

if(listbox1.SelectedIndex >= 0)

{

//Index 0 represents 1st item that was added to the listbox and that's Austria

if(listbox1.SelectedIndex ==0)

{

MessageBox.Show("Vienna");

}

else if(listbox1.SelectedIndex == 1)

{

MessageBox.Show("Toronto");

}

else if(listbox1.SelectedIndex ==2)

{

MessageBox.Show("London");

}

else if(listbox1.SelectedIndex == 3)

{

MessageBox.Show("Paris");

}

else if(listbox1.SelectedIndex ==4)

{

MessageBox.Show("Rome");

}

else if(listbox1.SelectedIndex == 5)

{

MessageBox.Show("Mexico City");

}

else if(listbox1.SelectedIndex == 6)

{

MessageBox.Show("Madrid");

}

}

else

{

MessageBox.Show("No item selected");

}

}

6 0
3 years ago
An vector of int named a that contains exactly five elements has already been declared and initialized. In addition, an int vari
kow [346]

Answer:

a[j] = 2*a[j+1];

Explanation:

The statement above assigns a new value to the element of the array indexed by j. The new value should be equal to twice the value stored in the next element of the array.

8 0
3 years ago
20 points: What is the sound mix?
Kay [80]
B because it just right
8 0
3 years ago
Other questions:
  • Why do you think there needs to be a specific code of ethics for health-related information on the Internet?
    15·2 answers
  • Mass production usually uses an _______________ ____________ or production line technique.
    7·1 answer
  • A ________ is s field or set of fields in a record that uniquely defines the record.
    7·1 answer
  • Can multiple processors can be installed in a single processor housing?
    14·2 answers
  • (Business: check ISBN-10) An ISBN-10 (International Standard Book Number) consists of 10 digits: d1d2d3d4d5d6d7d8d9d10. The last
    9·1 answer
  • How fast is a backwards long jump in Super Mario 64?
    7·1 answer
  • A bastion host allows the firewall to connect to the internal network and the perimeter network.TrueFalse
    15·1 answer
  • What should you do first when designing a program?
    5·2 answers
  • Match the following
    13·1 answer
  • What would be an ideal scenario for using edge computing solutions?
    6·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!