File / Folder Tally Tool I'm trying to learn C++ having come from a C/Assembly background.  I thought one of the first tools I'd make as a project is a "directory tally" program: 


It will count all the files in the current directory
If the user specifies, it will count all the folders in the current directory too
If the user specifies, it will count all the files in subdirectories as well (and folders if the user specifies)


Given that most of my academic, professional, and personal programming projects have involved C instead of C++ I'm pretty sure that my code is not idiomatic C++ (yet), but I have used guidelines like use std::(w)string over (w)char(_t) * strings, use the STL as much as possible, etc.

I'm wondering if I can get feedback on:


Is it obvious from looking at my code that I come from a C background?
What can I do to make this program look more like idiomatic C++?
The usual code review stuff, things I could write more clearly or bad things I'm doing that I should avoid.




#include &lt;iostream&gt;
#include &lt;filesystem&gt;

namespace fs = std::experimental::filesystem;

bool __cdecl recur_flag(std::wstring arg)
{
    if (arg.length() &lt; 2) return false;
    return ((arg.at(0) == L'-' || arg.at(0) == L'/') &amp;&amp; (arg.at(1) == L'r' || arg.at(1) == L'R'));
}

bool __cdecl dir_flag(std::wstring arg)
{
    if (arg.length() &lt; 2) return false;
    return ((arg.at(0) == L'-' || arg.at(0) == L'/') &amp;&amp; (arg.at(1) == L'd' || arg.at(1) == L'D'));
}

bool __cdecl help_flag(std::wstring arg)
{
    if (arg.length() &lt; 2) return false;
    return ((arg.at(0) == L'-' || arg.at(0) == L'/') &amp;&amp; (arg.at(1) == L'?'));
}



int __cdecl wmain(int argc, wchar_t *argv[])
{
    bool recur = false, dircount = false;
    unsigned long long count = 0;

    recur = ((argc &gt;= 2) &amp;&amp; (recur_flag(std::wstring(argv[1])))) || ((argc &gt;= 3) &amp;&amp; (recur_flag(std::wstring(argv[2]))));

    dircount = ((argc &gt;= 2) &amp;&amp; (dir_flag(std::wstring(argv[1])))) || ((argc &gt;= 3) &amp;&amp; (dir_flag(std::wstring(argv[2]))));

    if ((argc &gt;= 2) &amp;&amp; (help_flag(std::wstring(argv[1]))) || (argc &gt;= 3) &amp;&amp; (help_flag(std::wstring(argv[2]))))
    {
        std::wcout &lt;&lt; L"Usage: dircount /R /D /?" &lt;&lt; std::endl &lt;&lt; L"\t/R Recursive - count files in current directory and subdirectories" &lt;&lt; std::endl &lt;&lt;
            L"\t/D Include directories when counting files" &lt;&lt; std::endl &lt;&lt; L"\t/? Display this help message" &lt;&lt; std::endl &lt;&lt; std::endl;
        return 0;
    }

    if (recur)
    {
        for (auto &amp;p : fs::recursive_directory_iterator(fs::current_path()))
        {
            if (fs::is_directory(p))
            {
                if (dircount) count++;
            }
            else count++;
        }
    }
    else
    {
            for (auto &amp;p : fs::directory_iterator(fs::current_path()))
            {
                if (fs::is_directory(p))
                {
                    if (dircount) count++;
                }
                else count++;
            }
    }

    std::wcout &lt;&lt; L"There are " &lt;&lt; count &lt;&lt; L" items in the current directory"; if (recur) std::wcout &lt;&lt; L" tree"; std::wcout &lt;&lt; std::endl;

    return 0;
}
I'm sure someone else can provide a more comprehensive answer than I could, Just a few things:


string::at throws an out-of-range exception, since you're not actually catching anywhere, I'd use [] since at() is slower and you're already checking the string length, not that it really matters that much for this simple code though.
I would factor out the std::wstring(argv[1]) and similar into local variables so there are fewer brackets.
if statements without braces are less maintainable. 
wmain is windows specific, so this code won't compile elsewhere.