Starting from:

$25

keyboard the numbers -3 for

1) What do you think the following program will print if you type from the keyboard the numbers -3 for a and -5 for b ? #include <iostream int main (void) { int a, b ; cin a b; if ( a 0 || b 0) { if ( a 7) cout << "a greater than 7: " << a << '\n' ; } else cout << "Outer condition not true\n" ; return 0; } 2) If the condition (a 0 || b 0) is false, which one(s) of the following conditions would be true? ( a <=0 || b <= 0)
( a <= 0 && b<= 0) ( a 0 && b 0) ( b 0 || a <=0 ) 3) After executing the following if...then, the string "Condition met" is displayed. Why? (Hint: internally the value "flase" is represented as 0, and "true" as any non-zero value) int x = -5; if (x) cout << "Condition met" << endl; else cout << "Condition not met" << endl; 4) Read this online introduction to strigns in C++, and then, based on your readings, explain why the follwing line is not legal in C++ (in other words, explain the basic difference bewteen the char and string types) char c = "Hello";
C++ Program Write a program that accepts three unsorted values (int) from the keyboard into three variables a, b and c. After loading the variables, your program will arrange the values into a, b and c, so that a contains the larger, be the next and c the smallest. You can use any other variables in additon to a, b, c, as you see fit. You will have to use some variation(s) of the if construct. There are many ways to program this, but your challenge will be to achieve this without doing all possible comparisons. In fact, three comparisons should be enough, if you , for example, determine the largest number first, and keep track of its position in some way , so you can compare the other two, and then swap their positions.

More products