I have a program which prints a statement based on inputs. The print statement prints using all inputs, but I only want it to print inputs which are actually given. For instance:
std::cout << "-Number: " << number < "-Letter: " << letter << "-String: " << str << "-Sum: " << sum << std::endl;
(for the purpose of demonstration, the variables above are arbitrary, this is just to show a point)
So this print statement is called after every iteration of a loop. The values can be anything, but I do not want it to print if a value was not received. Ideally, this would be done like so:
// Get input... Then print statement...
// If input was not received for a value (i.e. it equals none) then skip that value
std::cout << "-Number: " << number < "-Letter: " << letter << "-String: " << str << "-Sum: " << sum << std::endl;
number = none, letter = none, str = none, sum = none // reset inputs and repeat loop
(Once again, the above is pseudo-code for the purpose of demonstration)
Is this possible in C++?