Hash Fellow robcat2075 Posted August 6, 2023 Hash Fellow Posted August 6, 2023 Lesson 16 Comparing Floats Turns out... floating point numbers are never quite what they seem. Program idea: write a program to test if a float variable set to 1.1 will be evaluated as equal to, greater than or less than 1.1 When that is known, add tests to the program to see how little needs to be added (or subtracted) to the explicit value to make the evaluation with the variable come out differently from before. Program idea: A bit of code like this will show that a floating point variable set to 1.1 will evaluate as greater than a literal 1.1 float myVariable; myVariable = 1.1; if (myVariable > 1.1) { cout>> "myVariable is greater than 1.1"<< endl; } Write a program to test how little the literal 1.1 needs to be increased by to change the above outcome. Lesson 17 C++ Conditions Conditions allow you combine multiple small decisions into one big decision. Program idea: Think of a job that has several qualifying factors. For example, an astronaut has to be in certain height and weight ranges Write a program that prompts the user to enter their values for the factors and then tells them if they get the job. If they don't qualify, tell them which category(s) they missed on. Extra credit if your program has a use for both && and || @Roger @Shelton @Rodney Quote
Recommended Posts
Join the conversation
You are posting as a guest. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.