I'm in a C++ class in the local community college, and one of the Lab Assignments tells us to make a program to compare a table of numbers.
However, the method I am thinking of for comparisons requires the use of if/else statements to aid in setting the values of variables to other variables. To give an example of such a statement in pseudocode.
If num1 is less than num2, then num1 is equal to shrtstA, else nothing changes.
The numbers are set to variables and what I am trying to make the program determine through those comparisons is which number is the least of the numbers on the table.
I'm sure I'll have to use % here as well, but that is not the point of this post.
The point I am asking is this: how do I tell the computer that nothing happens or changes if the condition of the if statement is not met?
I'm assuming that "then num1 is equal to shrtstA" means "then num1 is assigned the value of shrtstA", because testing for equality wouldn't make sense. And please give your variables meaningful names (or short, distinctive names).
Like I said, the goal of my program is to test and find which of a set of numbers is the least out of all. No specifics of what way to compare them, or what to compare them for, were given for the assignment. So I decided to make a program that finds which is the least.
For example, you take the run times of an athletic runner written in a table.
First Run: 28.4
Second Run: 30.5
Third Run: 25.2
Then have the program find the least out of all of them. I don't however want to end up coming up with an incorrect result because the computer didn't know not to do anything if the condition isn't met.
I know what I am not understanding here is probably simple, but I don't know exactly what it is.