Question
Write correct C++ expressions to determine the following relational [Boolean) values. Assume your expression will go into the parenthesis (of a single if() statement. You may assume that the following variables a-e already properly declared and set to reasonable values before your test x: a. lest whether the value of x is in the interval (0, 100) b. Test whether a character ch is a letter in the ASCII set of capital, letters. c. Test if the numbers c, d and e form the sides of a triangle, (use one if statement). Write a complete C++ program that prompts the user to enter a series of numbers, stopping at the first non-positive (0 or smaller) value entered After the user enter! the series print the sum, count, and the (floating point) average You may not assume there will be any positive entries.
Explanation / Answer
Hi, I have answered Q28.
Please repost others in separate post.
28)
a. x is in interval (0, 100)
if(x>=0 && c<=100)
b.
'A' = 65
'Z' = 90
if(ch>='A' && ch<='Z')
c)
In a triangle, a side can notbe greater than sum of other two sides
if(c < (a+b) || b < (a+c) || a < (b+c))