>>2729
Bear in mind that in C/C++ any non-0 value will evaluate to true...so your or'd string literals effectively become:
if(timeUnit == "Seconds" || true || true || true || true || true)
More importantly, comparing string variations like this is an exercise in insanity - there are too many combinations to effectively parse (what if a grill finds your program and enters "SeCoNdS"?).
Consider normalizing your input string to all lowercase and strip punctuation/trim whitespace:
#include <algorithm>
#include <string>
#include <cctype>
// this is the fancypants way of doing it
std::string data = "Abc";
std::transform(data.begin(), data.end(), data.begin(), ::tolower);
// other processing is left as an exercise to the reader
if(data == "abc")
{
// do stuff
}
You could also match using regular expressions, though I haven't really used regexes in C++ (more in scripting Python or JS):
// you'll need C++11 for this
// if using gcc, add the "-std=c++11" switch
#include <iostream>
#include <regex>
#include <string>
int main()
{
std::cout << "oh herro" << std::endl;
std::string str = "pUmPkIn SpIcE lAtTeE SECONds omg ponies";
// Pattern to match against,
// with case insensitive flag
std::regex expr(".*(second|secs).*",
std::regex_constants::icase);
if(std::regex_match(str, expr))
std::cout << "Yes" << std::endl;
return 0;
}