Question

In: Computer Science

Assume that: float a, b, c, d, f; and variables b, c, d, f are initialized....

  1. Assume that: float a, b, c, d, f; and variables b, c, d, f are initialized. Write a line of c++ code that calculates the formula below and stores the result to the variable a:

Solutions

Expert Solution


#include <iostream>

using namespace std;

int main()
{
    //declare
    float a,b,c,d,f;
    //intialize
    b=1.5;
    c=2.3;
    d=4.5;
    f=9.54;
    //caluclte sum of b,c,d,f and storing in a 'a'
    a=b+c+d+f;
    
    //print result
    cout<<"result :"<<a;

    return 0;
}

------------------------------------------------------------------------------------------------------------


Related Solutions

Assuming that the variables a, b, c, d, and f are scalars, write MATLAB statements to compute and display
Assuming that the variables a, b, c, d, and f are scalars, write MATLAB statements to compute and display the following expressions. Test your statements for the values a = 1.12, b = 2.34, c = 0.72, d = 0.81, and f = 19.83.
12. Assume that we randomly choose from the letters {A, B, C, D, E, F, G,...
12. Assume that we randomly choose from the letters {A, B, C, D, E, F, G, H, I, J, K, L} (without replacing the letters), until they have all been taken. (a) Find the probability that the letters A and K are chosen successively in the given order. (b) Find the probability that the letters G, H, I, are chosen successively in the given order. c) Find the probability that the string "LAI" appears somewhere in the sequence of letters....
Given a Boolean function: f(a,b,c,d) = m(1,6,7,10,12)+dc(3,4,9,15). i) Design a circuit for implementing f(a,b,c,d) with ONE...
Given a Boolean function: f(a,b,c,d) = m(1,6,7,10,12)+dc(3,4,9,15). i) Design a circuit for implementing f(a,b,c,d) with ONE 4-to-1 MUX and other basic logic gates. USE a and b as select inputs. ii) Draw the circuit. iii) Write the VHDL code for a 4-to-1 MUX, named “mux_4to1”, with input: a, b, c, d, s0, s1; and output: z. iv) Write the complete VHDL code for the above circuit in part (iii), named “Boolean_MUX”.
Assume chromosome 1 has the following structure: A B centromere C D E F G What...
Assume chromosome 1 has the following structure: A B centromere C D E F G What could be the result of a pericentric inversion? Where should the chromosome break to obtain this aberration?
Seven people (A,B,C,D,E, F, and G) are seated in a row. Suppose A,B, and C are...
Seven people (A,B,C,D,E, F, and G) are seated in a row. Suppose A,B, and C are freshmen, D and E are sophomores and F and G are juniors. How many arrangements are possible if: (a) D and F must sit together? (b) A and C must not sit together? (c) All freshmen must sit together? (d) All freshmen must sit together, all sophomores must sit together, and all juniors must sit together? (e) Exactly two people sit between A and...
If there are 7 total notes C, D, E, F, G, A, and B and if...
If there are 7 total notes C, D, E, F, G, A, and B and if a five-note melody is selected at random (so that all melodies counted in part (a) are equally likely to be chosen), what is the probability that the melody will include exactly two “A” notes, but no other repeated notes? (A few allowable examples: AACEG, ACAEG, DFACA, EAABC, etc.)
1.            Determine whether the function f from { a, b, c, d } to {a,...
1.            Determine whether the function f from { a, b, c, d } to {a, b, c, d, e} is injective (one-to-one), surjective (onto) and/or bijective (one-to- one correspondence) : f(a) = a,            f(b) = c,            f(c) = b, f(d) = e a. Is this function injective?              . surjective?              . bijective?              . If your answer is no for any of the above, explain:             b. Is there an inverse for this function?              . c. Is the composition f...
List what the a.) independent and b.) dependent variables are and c.) experimental and d.) control...
List what the a.) independent and b.) dependent variables are and c.) experimental and d.) control group are in the following study. A study wanted to look at the effects of coffee on students' performance in school. The researchers gave one group of students one cup of coffee a day and gave another group a glass of warm water.
Consider the cross: A/a; b/b; C/c; D/d; E/e x A/a; B/b; c/c; D/d; e/e a) what...
Consider the cross: A/a; b/b; C/c; D/d; E/e x A/a; B/b; c/c; D/d; e/e a) what proportion of the progeny will phenotypically resemble the first parent? b) what proportion of the progeny will genotypically resemble neither parent?
Consider the cities B,C,D,E,F,G The costs of the possible roads between cities are given below: c(B,F)...
Consider the cities B,C,D,E,F,G The costs of the possible roads between cities are given below: c(B,F) = 11 c(B,G) = 10 c(C,G) = 8 c(D,E) = 12 c(D,F) = 13 c(E,F) = 9 c(E,G ) = 7 What is the minimum cost to build a road system that connects all the cities?
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT