Question

In: Computer Science

1. Make the flow diagram and the C ++ program that receives three integer values ​​R,...

1. Make the flow diagram and the C ++ program that receives three integer values ​​R, T and Q, determine if they satisfy the expression below, and if so, show the corresponding values ​​of R, T and Q. R'- T '+ 4 * Q? <820

2. Construct a flow chart and the corresponding program in C which, when receiving Y as data, calculates the result of the following function and prints the values ​​of X and Y.

Solutions

Expert Solution

1. C++ program to accept three values and checks the conditions

Flow chart

Source Code

#include<iostream>
using namespace std;
int main() {
        int R,T,Q;
        cout<<" Enter value for first number:";
        cin>>R;
        cout<<" Enter value for second number:";
        cin>>T;
        cout<<" Enter value for third number:";
        cin>>Q;
        if(R-T+4*Q<820) {
                cout<<" The values for R :"<<R<<" T:"<<T<<" Q:"<<Q;
        }
        return 0;
}

The output:

Enter value for first number:12
Enter value for second number:60
Enter value for third number:45
The values for R :12 T:60 Q:45

2. C++ program to accept two values and check conditions

Flowchart:

Source code:

#include<iostream>
using namespace std;
int main() {
        int X,Y;
        cout<<" Enter value for first number:";
        cin>>X;
        cout<<" Enter value for second number:";
        cin>>Y;
        
        if(X>Y) {
                cout<<" The values of variables  X :"<<X<<" and Y:"<<Y;
        }
        return 0;
}

Output


Related Solutions

c++ Write a program that will ask the user for three pairs of integer values. The...
c++ Write a program that will ask the user for three pairs of integer values. The program will then display whether the first number of the pair is multiple of the second. The actual work of making the determination will be performed by a function called IsMultiple that takes two integer arguments (say, x and y). The function will return a Boolean result of whether x is a multiple of y.
Write a C program that allows: Three integer values to be entered (read) from the keyboard,...
Write a C program that allows: Three integer values to be entered (read) from the keyboard, Display the sum of the three values on the computer screen as follows: The integers that you have entered are: a b c The sum of a , b & c is ______ Thank you! C Code: Output screen:
Write a C program to Declare an integer array of size 10 with values initialized as...
Write a C program to Declare an integer array of size 10 with values initialized as follows. int intArray[] = {1, 2, 3, 4, 5, 6, 7, 8, 9, 10}; Compute each item of a new array of same size derived from the above array by: adding first item (intArray[0]) of the array with 3rd, 2nd with 4th, 3rd with 5th and so on. For the last-but-one item intArray[8], add it with first item and for the last item (intArray[9])...
• Write a C++ program that asks the user to input two integer values, then calls...
• Write a C++ program that asks the user to input two integer values, then calls a void function "swap" to swap the values for the first and second variable. • As we mentioned before, in order to swap the valors of two variables, one can use the following: temp= variable1; variable1 = variable2; variable2 = temp; • Display the two variables before you call swap and after you call that function. Comment in code would be greatly appreciated to...
In C ++, Design and implement a program that reads from the user four integer values...
In C ++, Design and implement a program that reads from the user four integer values between 0 and 100, representing grades. The program then, on separate lines, prints out the entered grades followed by the highest grade, lowest grade, and averages of all four grades. Format the outputs following the sample runs below. Sample run 1: You entered:    95, 80, 100, 70 Highest grade: 100 Lowest grade:   70 Average grade: 86.25
Design a C program to print out the unsigned char (integer) values of the 4 bytes...
Design a C program to print out the unsigned char (integer) values of the 4 bytes in sequential order (i.e., the first byte is printed first). Using the code framework provided below, the printing is done by the function void byte_value(int *), in which only pointer variables can be declared and used. #include <stdio.h> ​ void byte_value(int *); ​ int main() { int n = 1; byte_value(&n); printf("Enter an integer: "); if (scanf("%d", &n) == 1) byte_value(&n); return 0; }...
C program 1.// rotate the values pointed to by three pointers// so values move from xp...
C program 1.// rotate the values pointed to by three pointers// so values move from xp to yp, yp to zp and zp to xpvoid rotate(int *xp, int *yp, int *zp)​ { return;} 2.// Write a function that returns 0 if x is 0, returns -1// if x < 0, returns 1 if x > 0// Your code must follow the Bit-Level Integer Coding Rules// on the textbook (located between hw 2.60 and 2.61).// You can assume w = 32.//...
in C++ Compile and run the program for the following values: r = 2 Cm, h...
in C++ Compile and run the program for the following values: r = 2 Cm, h = 10 Cm. The answer should be: The cross section area of the cylinder is 3.8955634 c The side area of the cylinder is 19.474819 inch-sqr Did you get the same answer? Explain the reason for such an error and fix the problem. Modify the previous program to include a new function called total_area, that computes the total suface area of a cylinder. The...
C++ OOP Make a program to evaluate infix arithmetic expressions containing integer operands and the operators...
C++ OOP Make a program to evaluate infix arithmetic expressions containing integer operands and the operators + (addition), - (subtraction), * (multiplication), / (division) and pairs of parentheses, properly nested. Use the following two-stack algorithm (by E. W. Dijkstra): If the next token in the expression is an integer, push the integer onto the value stack. If the next token in the expression is an operator, If the operator stack is empty or the priority of the operator is greater...
Write a c program arrays2.c that checks if an integer array contains three identical consecutive elements....
Write a c program arrays2.c that checks if an integer array contains three identical consecutive elements. Assume the number of identical consecutive elements are no more than three if they exist. Sample input/output #1: Enter the length of the array: 11 Enter the elements of the array: -12 0 4 2 2 2 36 7 7 7 43 Output: The array contains 2 of three identical consecutive elements: 2 7 Sample input/output #2: Enter the length of the array: 4...
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT