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
lara31 [8.8K]
3 years ago
5

1. For the following program to be executed over the single accumulator

Computers and Technology
1 answer:
AlexFokin [52]3 years ago
6 0

Answer:

The answer to this question is given below in the explanation section.

Explanation:

#include <iostream> // it is preprocessor director that manipulate the input output in the program

using namespace std;// it is used to format input and output

int main() { // main function is started

int x = 5; // variable x is declared and initialized with value 5.

int y = 6; //variable y is declared and initialized with value 6.

int z = 34;  //variable z is declared and initialized with value 34.

int total = (x+(x + y)*z+y); // variable total is declared and initialized with value of x,y,and z. and calculation performed on these value such as (5+(5+6)*34+6) that is equal to 385.

cout << total; // print the value of total variable that is 385

return 0;

}​

You might be interested in
Which one of the following items would you be most likely to keep in a database ?
DerKrebs [107]
C.) Payroll records. These are the most extensive and data-intensive.
8 0
2 years ago
. Convert your age into binary and then to hexadecimal. Show your work.
Dovator [93]

Explanation:

Age = 23.

To convert a base 10 number to hexadecimal number we have to repeatedly divide the decimal number by 16 until  it becomes zero and store the remainder in the reverse direction of obtaining them.

23/16=1 remainder = 5

1/16=0 remainder = 1

Now writing the remainders in reverse direction that is 15.

My age in hexadecimal number is (15)₁₆.

5 0
3 years ago
Write a statement that compares the values of score1 and score2 and takes the following actions. When score1 exceeds score2, the
vaieri [72.5K]

Answer:

player1Wins = player1Losses = player2Wins = player2Losses = tieCount = 0

score1 = 10

score2 = 10

if score1>score2:

   player1Wins=player1Wins+1

   player2Losses=player2Losses+1

   print("player1 wins")

elif score2>score1:

   player2Wins=player2Wins+1

   player1Losses=player1Losses+1

   print("player2 wins")

else:

   tieCount=tieCount+1

   print("tie")

Explanation:

Since your indentation can not be understand what you give us, please try to do it as you see in the answer part.

Although it seems that this is a part of the code, it is normal that you get errors. However, since you keep track of the variables, it is better to initialize the variables that will keep the counts. Since initially, they are 0, you may set them as 0. Also, if you assign the values to the scores, probably you would not get any error. This way, you may test your code as I did.

Other than these, in the else part you do not need to write "score1=score2", because if score1 is not greater than score2 and if score2 is not greater than score1, this already implies that they are equal

8 0
3 years ago
RAM memory is considered volatile because this memory is erased when the computer is turned off
Goshia [24]
False because ram is constantly always running
5 0
2 years ago
What is the basics of C++
arlik [135]
Here are the basics of C++...

Number 1. Printing text onto the screen:
std::cout << "Your text here\n"; 
The \n creates a new line.

Number 2. Initializing variables and setting variables
There are a few different types of variables in C++...
Integers, floats, chars, and strings.
To let C++ know what type of variable you are about to create, you put the type before the variable name.

Here are some examples:
int number = 10;
float r = 2.45;
char[4] = "Code";
string name = "Bob";

Number 3. Comments

In programming comments are very useful. They help other programmers understand your code.

To make a single line comment in C++ you do this:

// your comment

To make a multi-line comment in C++ you do this:

/*
My multi-line comment here
*/

Number 4. Math

In C++ you have math operators. These operators are + - * / %
I'm pretty sure you are familiar with the first four operators. But you may not know the last one. Don't worry... I'll explain that one to you.

Addition:

std::cout << 35 + 23 // this will print out 58

Subtraction:

std::cout << 102 - 56; // this will come out as 46

Multiplication:

std::cout << 34 * 9; // product will be 306

Division:

std::cout << 164 / 4; // quotient will be 41

Modulus:

Now we get to the operator you may or may not know. The modulus.
The modulus operator gets the remainder of division of a by b.

std::cout << 10 % 4; // it will print out 2

You can even store math operations in variables...

int answer = 40 + 38;
std::cout << answer; // this will print out 78

You can even add variables...

int x = 28;
int y = 58;
int answer = 86;
std::cout << answer;
std::cout << x + y;

Number 5. Comparison Operators.

Comparison operators compare two values to see if its true or false...
These are mainly used in if statements...

Here are the comparison operators:

== Equal
!= Not equal
> Greater than
< Less than
<= Less or equal
>= Greater or equal

Number 6. If Statements

This is the structure of an if statement:

if(...){
// execute code if true
} else if(...){
// execute this block of code if first if statement was false
}else {
// execute this block of code if false
}

if(2 > 1) {
std::cout << "2 is greater than 1";
}

The code above will indeed execute. Because two is greater than 1.

Number 7. Functions

If you have a block of code that will be repeated multiple times through out your program, functions will be handy.

To make a function you must specify the type of the function. This called the return type.
Which are int (integers), floats (decimals), and string (strings).
There are more, but I decided to focus on those three.

Then you give your function a name. 

int my_function(){
// your code
}

To call a function, you simply type the name of the function with parentheses.

my_function();

To make a function with parameters, do same thing above, except in the parentheses you give your parameters.

int my_function(int x, int y){
// your code
}

As you can see, you separate the parameters with a comma.

in my_function(int x, int y){
int z = x + y;
std::cout << z; // this will print out the sum of x and y
}

To call your function with parameters, type your function name with parentheses and in the parentheses type your values.

my_function(3, 4); // this will print out 7

Also, another type of function is the void type. In int type functions, at the end of your code in the function, you should type return 0.
This allows C++ know that code wen't without any errors...

In void type function this isn't really necessary...

If you have anymore questions or you found something to be confusing or you want to learn more C++, please write me a message.



3 0
3 years ago
Other questions:
  • Which strategy are you using when you only read the title, section headings, and captions?
    12·2 answers
  • What does DKIM stand for?
    9·2 answers
  • The algorithm ADDN implements N-bit fixed-width binary addition for non-negative integers and ignores overflows. For example, AD
    13·1 answer
  • How do users log into Windows 8?
    7·1 answer
  • _____ describes the layout of the screen. Block-based, Interface, Editor, Player
    11·2 answers
  • Fill in the blanks:<br>Can anyone help me out with this <br>​
    9·1 answer
  • What is file management?can please help me​
    14·2 answers
  • Write an assembly code to implement the y=(x1+x2)*(x3+x4) expression on 2-address machine, and then display the value of y on th
    7·1 answer
  • Camera work is at the center of video production. True or False?
    14·1 answer
  • Why are pirated software considered a threat?​
    6·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!