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
Ugo [173]
3 years ago
9

Answer for 3.4.8 rectangle code HS

Computers and Technology
1 answer:
tigry1 [53]3 years ago
7 0

Answer:

i think Make variables to represent the length and width of a rectangle, called length

and width

, respectively. You should set length

to 10 and width

to 5.

Then, write some mathematical expressions to computer the area and perimeter of the rectangle and save these values inside variables named area and perimeter

.Use print

statements to display the area and perimeter of the rectangle.

Your output should print the area on the first line and the perimeter on the second, like this:

50 30  Rectangle Area Formula:

Area = L * W

Explanation:

You might be interested in
In best practice, should you use all lowercase, all uppercase or a mixture of cases in HTML tag names?
mixas84 [53]
B considering it’s proper english, we went through this about a week ago
7 0
2 years ago
The input stream of a stack is a list of all the elements we pushed onto the stack, in the order that we pushed them. If the inp
Sidana [21]

Answer:

Push Z

Push Y

Pop Y

Push X

Pop X

Push W

Push V

Pop V

Push U

Pop U

Pop W

Pop Z

Push T

Push S

Pop S

Push R

Pop R

Pop T

Explanation:

A stack is a term in computer science that defines an abstract data type that acts as a collection of elements. It has two operations which are mainly push and pop.

Push is used in adding elements to the collection, while pop is used in removing elements from the collection.

If the element A has been pushed to the stack, you check if the top element in the pop[] sequence is A or not.

If it is A, you then pop it right, else top of the push[] sequence will be changed and make the sequences invalid.

So, similarly do the same for all the elements and check if the stack is empty or not in the last.

If empty you then print True else print False.

4 0
3 years ago
2.
inn [45]

Answer:

True

Explanation:

Readability is how easy it is to read words, phrases, blocks of copy such as a book, a web page or an article. Legibility is a measure of how easy it is to distinguish one letter from another in a particular typeface.

Your welcome

5 0
3 years ago
2- (8 point) Write a program using the instructions below. Assume that integers are stored in 4 bytes. a) Define an array of typ
lakkis [162]

Answer:

a)  

int apples [5] = {2, 4, 6, 8, 10};

b)

int *aPtr   //this is the pointer to int

Another way to attach a pointer to a an int variable that already exists:

int * aPtr;

int var;

aPtr = &var;

c)

for (int i = 0; i < size; i++){

       cout << values[i] << endl;    }

d)  

   aPtr = values;

   aPtr = &values[0];    

both  the statements are equivalent

e)

If its referring to the part d) then the address is:

cout<<aPtr;

f)

     for (int i = 0; i < size; ++i) {

            cout<<*(vPtr + i)<<endl;    }

g)

   cout << (aPtr + 3) << endl;  // address referenced by aPtr + 3

   cout << *(aPtr + 3) << endl; // value stored at that location

This value stored at location is 8

h)

    aPtr = &apples[4];

    aPtr -= 4;

    cout<<aPtr<<endl;

    cout<<*aPtr<<endl;  

Explanation:        

a)

int apples [5] = {2, 4, 6, 8, 10};

In this statement the array names is apples, the size of the array is specified in square brackets. so the size is 5. The type of array apples is int this means it can store integer elements. The values or elements of the array apples are even integers from 2 to 10. So the elements of array are:

apples[0] = 2

apples[1] = 4

apples[2] = 6

apples[3] = 8

apples[4] = 10

b)

In this statement int *aPtr  

The int* here is used to make the pointer aPtr points to integer object. Data type the pointer is pointing to is int. The asterisk symbol used with in makes this variable aPtr a pointer.

If there already exists an int type variable i.e. var and we want the pointer to point to that variable then declare an int type pointer aPtr and aPtr = &var; assigns the address of variable var to aPtr.

int * aPtr;

int var;

aPtr = &var;

c)

The complete program is:

int size= 5;

int values[size] = {2,4,6,8,10};

for (int i = 0; i < size; i++){

       cout << values[i] << endl; }

The size of array is 5. The name of array is values. The elements of array are 2,4,6,8,10.

To print each element of the values array using array subscript notation, the variable i is initialized to 0, because array index starts at 0. The cout statement inside body of loop prints the element at 0-th index i.e. the first element of values array at first iteration. Then i is incremented by 1 each time the loop iterates, and this loop continues to execute until the value of i get greater of equal to the size i.e. 5 of values array.

The output is:

2

4

6

8

10

d)

aPtr = values;

This statement assigns the first element in values array to pointer aPtr. Here values is the address of the first element of the array.

aPtr = &values[0];    

In this statement &values[0] is the starting address of the array values to which is assigned to aPtr. Note that the values[0] is the first element of the array values.

e)

Since &values[0] is the starting address of the array values to which is assigned to aPtr. So this address is the physical address of the starting of the array. If referring to the part d) then use this statement to print physical address is aPtr pointing to

cout<<aPtr;

This is basically the starting address of the array values to which is assigned to aPtr.

The output:

0x7fff697e1810                

f)

i variable represents offset and corresponds directly to the array index.

name of the pointer i.e. vPtr references the array

So the statement (vPtr + i) means pointer vPtr that references to array values plus the offset i array index that is to be referenced. This statement gives the address of i-th element of values array. In order to get the value of the i-th element of values array, dereference operator * is used.  It returns an ith value equivalent to the address the vPtr + i is pointing to. So the output is:

2

3

6

8

10

g)

values[0] is stored at 1002500

aPtr + 3 refers to values[3],

An integer is 4 bytes long,

So the address that is referenced by aPtr + 3 is

1002500 + 3 * 4 = 1002512

values[3] is basically the element of values array at 3rd index which is the 4th element of the array so the value stored at that referred location  is 8.

h)

Given that aPtr points to apples[4], so the address stored in aPtr is

1002500 + 4 * 4 = 1002516

aPtr -= 4  is equivalent to aPtr = aPtr - 4

The above statement decrements aPtr by 4 elements of apples array, so the new value is:

1002516 - 4 * 4 = 1002500

This is the address of first element of apples array i.e 2.

Now

cout<<aPtr<<endl; statement prints the address  referenced by aPtr -= 4 which is 1002500  

cout<<*aPtr<<endl;  statement prints the value is stored at that location which is 2.

6 0
3 years ago
can someone please help me with my school work you can look under my questions please help me ​my mom is going to kill me when s
Snezhnost [94]

Answer:

hey panda I'm doing good how about you

5 0
3 years ago
Other questions:
  • By default, text is ______aligned and values are______________aligned
    6·1 answer
  • How to solve 3(x - 2) = 9x<br><img src="https://tex.z-dn.net/?f=3%28x%20-%202%29%20%3D%209x" id="TexFormula1" title="3(x - 2) =
    14·1 answer
  • How do i end my current plan that i never signed up for, the basic one it charged me $24
    11·2 answers
  • Varun wants to start his own business. Suggest him at least four functions of an entrepreneur.
    8·2 answers
  • Jackson is teaching a class the concept of the binary number system. Which term will he use to refer to the leftmost bit of a bi
    11·2 answers
  • Yo, my Lenovo laptop keeps showing this screen but I can't sign in, can someone help me?
    5·2 answers
  • Write an application that displays the sizes of the files lyric1.txt and lyric2.txt in bytes as well as the ratio of their sizes
    15·1 answer
  • An informative presentation can be used for conducting a classroom discussion.
    6·1 answer
  • What is known as the global network of computers?
    9·2 answers
  • This code is supposed to accept a word as input, and then print that word to the screen.
    15·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!