I've been looking around the web and this site for an answer to this scenario but everything I've come across is about reading it from an outside file or changing what the command is in the code but not changing what it does. I'm just messing around with code to refresh myself before I do anything practical. I'm verifying that certain constants are equal to a number that I have specified. (I've never posted here and I've been doing this all day so I'm not taking the time to learn the code insert tags.)
string one = "CHAR_MAX"; // <<< I know this doesn't work. It's what I am
// trying to do in the loop.
if (one == 127)
cout << "Max char count: " << CHAR_MAX << ">>> Pass >>> " one;
I know there are other only slightly more tedious ways to accomplish this. But I'm fairly sure there is a way to do this without an external .txt file to be read from and I've spent far too long trying to figure it out. It's driving me crazy and it's been almost 3 hours since I got to this.
Edit: I'll look more into the 'constexpr' but from what I'm seeing I think it may. There are numerous other ways for me to complete this yes. I just want to understand a way in that backwards manner. For comprehension. As for as intentions (unless you mean something other with 'intend') go I'm looking at different ways to accomplish a silly program that has several variable limit constants. Like min long, max long, short, max int, etc. And I was thinking of ways to compare them with what the number is. Not for any reason to use. It'd be completely useless because they are predefined. I just thought of assigning the commands (forget what they are referred to in source code) such as CHAR_MAX to a variable that changes along with a for loop after outputting the results. I would have to define them in a list prior but I just couldn't figure out how. (Also: Thanks to the mod who changed my code block to read correctly.)
2nd Edit: Take all variable limits. 18446744073709551615 for unsigned long long. 4294967295 for long (not sure why it's this way, int is the same). Get those numbers with associated commands but by means of a for loop where the command is equal to a variable. (AKA 1 or even "one") It doesn't matter the name as long as it can contain the same command. I have a feeling "variable" is an incorrect way to phrase this but you'd be storing it with a changeable memory assigned call that you can use in a for loop by incrementing a counter for that loop and outputting an
if(*command-as-variable* == *what that number is as a corresponding number*)
cout << "Pass";
else cout << "Fail";
enter code here
Depending on the circumstances I associate the terms with it COULD fail but if everything works correctly it should not. Like I said, Meaningless. Just a different way I could more efficiently write this code instead of having 19 different cout statements. It's how to execute the idea I am trying to find out. I still haven't looked at what constexpr is for but I am about to pass out now. It's been a long day. I'll edit this tomorrow after I look. Or if it's explained that'd be even better! :)