56 Posted Topics
Re: It's my understanding that Dev-C++ development has been discontinued. But Dev-C++ is not a compiler. It's an IDE that includes the GCC compiler. If you don't want to use Visual Studio, another IDE I've seen recommended is [url=http://www.codeblocks.org/]Code::Blocks[/url]; however, I've found Visual Studio 2003 to be very standards compliant (though … | |
Re: First of all, it looks like you've got the wrong overloaded version of std::transform. Namely, you're using the one that takes a binary function as its last argument, while you want it to take an unary function. You could do: [code] std::transform(v.begin(),v.end(),std::ostream_iterator<[COLOR=#0000ff]int[/COLOR]>(cout," "),std::bind2nd(std::multiplies<[COLOR=#0000ff]int[/COLOR]>(), 5)); [/code] This would give you the … | |
| |
Re: 1. You're not leaving space for the '\0' terminator. 2. This line is wrong: [code] plural[i + 1] = 's'; [/code] 3. The user could still enter more than 6 letters and cause a buffer overrun. I'd recommend using a std::string instead. Or at least use getline to limit the … | |
Re: I'm not too familiar with that MFC specific stuff (like AFX_NOVTABLE and IMPLEMENT_DYNCREATE) but I don't think I see where your errors are coming from. Which line are they pointing to? | |
Re: If you have the boost library installed, you might consider using boost::filesystem instead (which would be more portable): [code] [COLOR=#0000ff]#include[/COLOR][COLOR=#000000] <boost/filesystem/operations.hpp>[/COLOR] [COLOR=#0000ff]#include[/COLOR][COLOR=#000000] <iostream>[/COLOR] [COLOR=#0000ff]using [/COLOR][COLOR=#0000ff]namespace[/COLOR][COLOR=#000000] boost::filesystem;[/COLOR] [COLOR=#0000ff]int[/COLOR][COLOR=#000000] main()[/COLOR] { path mypath("/boost_1_33_1"); [COLOR=#0000ff]if[/COLOR] (!exists(mypath)) { std::cerr<<"Path does not exist!"; [COLOR=#0000ff] return[/COLOR] EXIT_FAILURE; } directory_iterator dirIt(mypath); [COLOR=#0000ff]int[/COLOR] filecount=0; [COLOR=#0000ff]for[/COLOR] (directory_iterator dirIt(mypath);dirIt!=directory_iterator();dirIt++) { … |
The End.