c++
Given the following
code:
int number = 50;
Write the if statement to print “yes” and add one
to the number variable if the value stored in
the number variable is greater than 50 or less
than or equal to 75.
/* * C++ Program */ #include <iostream> using namespace std; int main() { int number = 50; if (number > 50 && number <= 75) { cout << "yes"; number += 1; } return 0; }
Note: The output does not appears because if condition is not getting true for the number = 50;
c++ Given the following code: int number = 50; Write the if statement to print “yes” and add...
C++ Given a int variable named callsReceived and another int variable named operatorsOnCall, write the necessary code to read values into callsReceived and operatorsOnCall and print out the number of calls received per operator (integer division with truncation will do). HOWEVER: if any value read in is not valid input, just print the message "INVALID". Valid input for operatorsOnCall is any value greater than 0. Valid input for callsReceived is any value greater than or equal to 0. Revel for...
in c++ language 1.Re-write the following for loop statement by using a while loop statement: int sum = 0; for(int i=0;i<=1000;i++){ sum+=i; } 1 (b). Following is the main () function of a program. The program asks a user to enter 150 integers and print the largest integer user entered. int main() { int score, highest; //missing portion of the program return 0; } 1(c). Find the missing portion of the following code, so the...
c code only Use If statement to write C code to calculate the area of a square. • Ask the user to enter the length Calculate the area as : Area = square of length Print the area If the area is less than or equal 5: print "Your square is small" If the area is greater than 5 and less than or equal 10: print "Your square is medium" • Otherwise print: "Your square is large
3-How would you write the following using C code? X is equal to Y (comparing X and Y not setting X to the value of Y) X is not equal to Y A is less than or equal to B Q is not greater than T X is greater than or equal to Y X is less than or equal to Y and A is not equal to B A is greater than 18 and H is greater than 68...
C++ Write code that will input a number and print the number, the square of the number, and the cube of the number. Continue the operation until 999 is entered. Write code that will request the length and width of a rectangle until 0 is entered for either the length or the width. Print the area and perimeter for each set of inputs. What is the output for the following loop? int number; number = 1; while (number < 11)...
Convert the following expressions to a single statement C++ code C++ code Expression If count is less than 100 or greater than 50 While letter starts with 'a' Add 5 to sum then divide it by 2
Write C++ code that creates an integer variable called number. Dereference a given pointer gPointer and places that value into the variable number. The pointer gPointer will have been declared and set to point to a value before your code runs. Your code will be placed inside the main function with all the appropriate #includes. After your code runs, the test case will execute the following code: cout << "number = " << number << endl; For example: Test Result...
Homework Part 1 Write a C program that declares and initializes a double, an int, and a char. You can initialize the variables to any legal value of your choosing. Next, declare and initialize a pointer variable to each of the variables Using printf), output the following: The address of each of the first three variables. Use the "Ox%x" format specifier to print the addresses in hexadecimal notation The value of each variable. They should equal the value you gave...
IN C++ Write a code to print out elements from a array/vector that is greater/less than a specific value.
I need to run each questions also with the outputs print 1. 3.1 Write an if statement that assigns 0 to x when y is equal to 20. If (y == 20) X=0; 2. 3.2 Write an if statement that multiplies payRate by 1.5 if hours is greater than 40. If (hours > 40) payRate - payRate * 1.5; 3. 3.12 Write nested if statements that perform the following test: If amounti is greater than 10 and amount 2 is...