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
aleksley [76]
4 years ago
5

Given the following expressions, what value would they have in a C++ program?

Computers and Technology
1 answer:
mario62 [17]4 years ago
5 0

Answer:

The program of the given expressions can be given as  

Program:

#include <iostream>

using namespace std;

int main()                         //define main function.

{

float a,b,c,d,e,f,g,h;                     //define variable for hold values.

a=13 / 4;

cout<<"a:"<<a<<endl;           //print value.

b= 2 + 12 / 4;

cout<<"b:"<<b<<endl;       //print value.

c=21 % 5;

cout<<"c:"<<c<<endl;       //print value.

d=3 - 5 % 7;

cout<<"d:"<<d<<endl;      //print value.

e=17.0 / 4;

cout<<"e:"<<e<<endl;      //print value.

f=8 - 5 * 2.0;

cout<<"f:"<<f<<endl;              //print value.

g=4 + 5 % 2 - 3;

cout<<"g:"<<g<<endl;             //print value.

h=15.0 + 3.0 / 2.0;

cout<<"h:"<<h<<endl;            //print value.

   return 0;

}

output:

a=3.

b=5.

c=1.

d=-2.

e=4.25.

f=-2.

g=2.

h=16.5.

Explanation:

In the above expression, all the options follow the bodmos rules. All the expression explanation can be given as:

In option(a) we divide the value.It gives the quotient.

In option(b) we first divide the value and then addition.

In option(c) we Modulus the value. It gives the remainder.

In option(d) we first Modulus the value and then Subtract It.

In option(e) we divide the value.It gives the quotient.

In option(f) we first multiply the value and then Subtract It.

In option(g) we first Modulus the value, second addition than subtraction.

In option(h) we first divide the value and then addition.

You might be interested in
Which letters appear in the home row on a keyboard?
weqwewe [10]
A, S, D, F, G, H, J, K, L, <semi colon ( ; ) and apostrophe ( ' ) as the last two on the right, in front of enter>  
8 0
3 years ago
Which topology is common these days?i need answer with fivereasons.
garik1379 [7]

Answer:

Star topology

Explanation:

<u>Star topology</u> : In a network,when different hosts(pc,laptops) are connected to a single communication point called server/hub/switch/computer.

Advantages of star topology :

  • When a single node is failed,it will not affect the entire system,the other nodes work as earlier.
  • We can add new nodes easily,without affecting the network.
  • Monitoring of the network eases,as you can only check switch/hub for it.We don't have to check each node at the time of failure.
  • Performance is better than other topology because the transfer of data is directly transferring from hub to a node.
  • Less complexity of architecture of network.The central hub is connected to each node no node-node connections are there.      
4 0
4 years ago
Most messages sent between Web services are coded in XML._____ are programming hooks or guidelines, published by organizations t
Ghella [55]

Answer:

The answer is "Application programming interface(APIs)".

Explanation:

API is a series of routines, set of rules or methods for the development of the application. It uses the graphical UI element software for utilization.  

  • It defines how the components can communicate with applications in theory.  
  • It is interlinked to an external software network for apps, which have access to its software and services.
6 0
3 years ago
Write a program that lets the user enter a nonnegative integer and then uses a loop to calculate the factorial of that number. P
Effectus [21]

Answer:

In C++:

#include <iostream>

using namespace std;

int main(){

   int num,fact=1;

   cout<<"Positive integer: ";

   cin>>num;

   if(num<0){

   cout<<"Positive integers only";

   }

   else{

       for(int i =1;i<=num;i++){

       fact*=i;

       }

       cout<<num<<"! = "<<fact;

   }

   

   return 0;

}

Explanation:

This line declares num and fact as integer. It also initializes fact to 1

   int num,fact=1;

This line prompts the user for a positive integer

   cout<<"Positive integer: ";

This line gets input from user

   cin>>num;

This line checks if input is negative

   if(num<0){

If input is negative, This line prints the following message

   cout<<"Positive integers only";

   }

   else{

If input is positive or 0; The following iteration calculates the factorial

<em>        for(int i =1;i<=num;i++){</em>

<em>        fact*=i;</em>

<em>        }</em>

This prints the calculated factorial

       cout<<num<<"! = "<<fact;

   }

5 0
4 years ago
All of the following are reserved keywords in C++ EXCEPT
Flura [38]

Answer:

e. tryorfail

Explanation:

Following are reserved keywords in C++:

  • this - A reference to the current object
  • friend - Used to designate a friend class which has special access privileges for members of the class
  • class - A keyword used for defining a C++ class
  • for - Looping construct in C++

tryorfail is not a valid keyword in C++. The relevant keyword is try for exception handling.

8 0
3 years ago
Other questions:
  • If you could make any blog, what would it be about and why?
    9·1 answer
  • I'm a number less then 40000.all my digits are multiples of 3.my first third a d fifth digits are the same both of my thousands
    10·1 answer
  • What is the process called if you are erasing data on your hard drive from a MAC
    12·1 answer
  • Write a program with a function that accepts a string as an argument and returns a copy of the string with the first character o
    11·1 answer
  • a mobile base in an urban environment has the power of 15 microW at 175 m. If the propagation follows an inverse cube power law,
    11·1 answer
  • If you are parked on an incline with a manual transmission vehicle and your vehicle is facing downhill, you should put your vehi
    12·1 answer
  • Write a C++ program to accept a bunch of numbers from the user. Accept the numbers in a loop and stop when the user enters 0. Pr
    8·1 answer
  • Which of these is NOT a benefit of being connected 24/7?
    11·1 answer
  • Louis has two sets of two gears (Set A and Set B) that he is using to build two different machines. He has all the gears laying
    13·2 answers
  • CAN SOMEONE PLEASE HELP ME
    9·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!