A weather station validates the rain into its critical level by its raindrops fell. Make program that will input number of raindrops fell, Check if raindrops fell is equal to 10,000 then display “CRITICAL RAIN”. Your program will be terminated if you input zero in the raindrops fell.
Define a function that will be given a pointer pointing to the first element of the linked list and two strings named first_string and second_string respectively. The function must search for the first_string in the list. If the list does not contain such a string, the function leaves the list unchanged. Otherwise, the function must add a new element in the linked list with the value of second_string after the first occurrence of the element containing the first_string. The function prototype should look like void add_after(node* , string , string)
The formula below decribes Newton's second law of motion
Force = Mass x acceleration
Using the variables below Write one line of code that will calculate the acceleration of a object.
// Mass in Kg
float mass = 50.3;
// Froce in N
int force = 720;
//acceleration
float accel;
//One line of code to calculate the acceleration of a object
//One line of code to calculate the acceleration of a object
Write a program that prompts the user to input height and width and print the hollow rectangle
as given in the output below. The program should check whether the both height and width
of rectangle are equal or not. Do not use nested loops.
In a right triangle, the square of the length of one side is equal to the sum of the squares of the lengths of the other two sides. Write a program that prompts the user to enter the lengths of three sides of a triangle and then outputs a message indicating whether the triangle is a right triangle.
Determine whether the following are valid switch statements. If not,
explain why. Assume that n and digit are int variables. (11)
a. switch (n <5 2)
{
case 0:
cout << "Draw." << endl;
break;
case 1:
cout << "Win." << endl;
break;
case 2:
cout << "Lose." << endl;
break;
}
b. switch (digit / 4)
{
case 0,
case 1:
cout << "low." << endl;
break;
case 1,
case 2:
cout << "middle." << endl;
break;
case 3:
cout << "high." << endl;
}
c. switch (n % 6)
{
case 1:
case 2:
case 3:
case 4:
case 5:
cout << n;
break;
case 0:
cout << endl;
break;
}
d. switch (n % 10)
case 2:
{
case 4:
case 6:
case 8:
cout << "Even";
break;
case 1:
case 3:
case 5:
case 7:
cout << "Odd";
break;
}
Suppose that sale and bonus are double variables. Write an if...else
statement that assigns a value to bonus as follows: If sale is greater
than $20,000, the value assigned to bonus is 0.10, that is 10%; If sale
is greater than $10,000 and less than or equal to $20,000, the value
assigned to bonus is 0.05, that is 5%; otherwise the value assigned to
bonus is 0, that is 0%.
What is the output of the following C11 code? (2, 5, 6)
int x = 15;
int y = 3;
if (x + y > 17 || y - x < 20)
{
y = x - y;
x = y + x;
cout << x << " " << y << " " << x + y << " " << y - x << endl;
}
else
{
x = y - x + y %5;
cout << x << " " << y << " " << x - y << " " << x + y << endl;
}
What is the output of the following program?
#include <iostream>
using namespace std;
int main()
{
int firstNum = 28;
int secondNum = 25;
cout << firstNum << " " << secondNum << endl;
cout << (firstNum = 38 - 7) << endl;
cout << (firstNum <= 75) << endl;
cout << (firstNum > secondNum + 10) << endl;
cout << (firstNum >= 3 * secondNum - 100) << endl;
cout << (secondNum - 1 == 2 * firstNum) << endl;
cout << firstNum << " " << secondNum << endl;
return 0;
}