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
Nutka1998 [239]
3 years ago
13

What will be the value of input_value if the value 5 is input at run time?

Computers and Technology
1 answer:
Lunna [17]3 years ago
5 0

Answer:

15

Explanation:

The if else state is used for checking the condition and if the condition is TRUE and program can execute the statement  within the if else.

Initially input_value is 5

then the if statement check the condition 5>5, condition FALSE because 5==5

it not less than 5.

then program move to else if and check condition 5>2, condition TRUE.

then, input_value = 5 + 10=15 execute and update the value to 15.

After that, program terminate the if else statement.

Therefore, the answer is 15.

You might be interested in
Create a Binary Expressions Tree Class and create a menu driven programyour program should be able to read multiple expressions
solong [7]

Answer:

Explanation:

Program:

#include<iostream>

#include <bits/stdc++.h>

using namespace std;

//check for operator

bool isOperator(char c)

{

switch(c)

{

case '+': case '-': case '/': case '*': case '^':

return true;

}

return false;

}

//Converter class

class Converter

{

private:

string str;

public:

//constructor

Converter(string s):str(s){}

//convert from infix to postfix expression

string toPostFix(string str)

{

stack <char> as;

int i, pre1, pre2;

string result="";

as.push('(');

str = str + ")";

for (i = 0; i < str.size(); i++)

{

char ch = str[i];

if(ch==' ') continue;

if (ch == '(')

as.push(ch);

else if (ch == ')')

{

while (as.size() != 0 && as.top() != '('){

result = result + as.top() + " ";

as.pop();

}

as.pop();

}

else if(isOperator(ch))

{

while (as.size() != 0 && as.top() != '(')

{

pre1 = precedence(ch);

pre2 = precedence(as.top());

if (pre2 >= pre1){

result = result + as.top() + " ";

as.pop();

}

else break;

}

as.push(ch);

}

else

{

result = result + ch;

}

}

while(as.size() != 0 && as.top() != '(') {

result += as.top() + " ";

as.pop();

}

return result;

}

//return the precedence of an operator

int precedence(char ch)

{

int choice = 0;

switch (ch) {

case '+':

choice = 0;

break;

case '-':

choice = 0;

break;

case '*':

choice = 1;

break;

case '/':

choice = 1;

break;

case '^':

choice = 2;

default:

choice = -999;

}

return choice;

}

};

//Node class

class Node

{

public:

string element;

Node *leftChild;

Node *rightChild;

//constructors

Node (string s):element(s),leftChild(nullptr),rightChild(nullptr) {}

Node (string s, Node* l, Node* r):element(s),leftChild(l),rightChild(r) {}

};

//ExpressionTree class

class ExpressionTree

{

public:

//expression tree construction

Node* covert(string postfix)

{

stack <Node*> stk;

Node *t = nullptr;

for(int i=0; i<postfix.size(); i++)

{

if(postfix[i]==' ') continue;

string s(1, postfix[i]);

t = new Node(s);

if(!isOperator(postfix[i]))

{

stk.push(t);

}

else

{

Node *r = nullptr, *l = nullptr;

if(!stk.empty()){

r = stk.top();

stk.pop();

}

if(!stk.empty()){

l = stk.top();

stk.pop();

}

t->leftChild = l;

t->rightChild = r;

stk.push(t);

}

}

return stk.top();

}

//inorder traversal

void infix(Node *root)

{

if(root!=nullptr)

{

cout<< "(";

infix(root->leftChild);

cout<<root->element;

infix(root->rightChild);

cout<<")";

}

}

//postorder traversal

void postfix(Node *root)

{

if(root!=nullptr)

{

postfix(root->leftChild);

postfix(root->rightChild);

cout << root->element << " ";

}

}

//preorder traversal

void prefix(Node *root)

{

if(root!=nullptr)

{

cout<< root->element << " ";

prefix(root->leftChild);

prefix(root->rightChild);

}

}

};

//main method

int main()

{

string infix;

cout<<"Enter the expression: ";

cin >> infix;

Converter conv(infix);

string postfix = conv.toPostFix(infix);

cout<<"Postfix Expression: " << postfix<<endl;

if(postfix == "")

{

cout<<"Invalid expression";

return 1;

}

ExpressionTree etree;

Node *root = etree.covert(postfix);

cout<<"Infix: ";

etree.infix(root);

cout<<endl;

cout<<"Prefix: ";

etree.prefix(root);

cout<<endl;

cout<< "Postfix: ";

etree.postfix(root);

cout<<endl;

return 0;

}

3 0
3 years ago
State four reasons why office automation is adopted in business establishment?​
olasank [31]

Answer:

The benefits of automated operations are higher productivity, reliability, availability, increased performance, and reduced operating costs.

Explanation:

6 0
3 years ago
State<br> any three (3) reasons why users attach speakers to their computer?
lidiya [134]

Answer:

To complete the computer setup, to hear audio, to share audio.

Explanation:

A computer is not <u>really</u> complete without speakers.

So that you can actually hear the computer's audio.

So that you can have multiple people hear the same audio. (Headphones do not do this)

4 0
3 years ago
How to sync songs from desktop to mobile device spotify.
Alisiya [41]

Answer:

The answer is below

Explanation:

In order to sync songs from desktop to mobile device Spotify. This following must be followed:

1. From the Spotify PC app, add Local Files in toe synchronized ed to a phone list.

2. Ensure to log into Spotify on mobile phone on the same WiFi network as PC.

3. Click on the menu button

4. Click on Music.

5. Click on Playlists and access folder with local music files

6. Click on the Available Offline switch at the top.

7. A green arrow is shown to depict successful synchronization.

5 0
3 years ago
What are the advantages and disadvantages of using thermoset plastics
Alex Ar [27]
Advantages
>fast processing
disadvantages
>limited service temperature performance
4 0
3 years ago
Other questions:
  • Jail and prison officials may generally limit inmate rights when the limitations serve
    13·2 answers
  • What are the most popular/up-and-coming social media applications?
    10·2 answers
  • ____ is an object-oriented programming language from Sun Microsystems which allows small programs called applets to be embedded
    13·1 answer
  • Mohammed's parents learn that his classmates have
    7·2 answers
  • On which of the following pointing devices can you control the pointer by sliding your fingertip?
    11·1 answer
  • Adding videos to your website can be tricky because there may be problems making sure they will play in all
    13·1 answer
  • Which of the following types of computers is typically used by governments and hospitals and can support hundreds of users?
    6·2 answers
  • Give short answers.
    14·1 answer
  • What can you do to improve your own digital wellness?
    7·2 answers
  • comparing the cost of care provided to medicare beneficiaries assigned to primary care nurse practitioners and physicians
    10·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!