Forum: C++ Jun 16th, 2009 |
| Replies: 9 Views: 502 1. About C4716: didn't you know that double F_Ite() function must return double type value? And where is return anything-of-double_type in the function body? It's your code, you have wrote double... |
Forum: C++ Jun 14th, 2009 |
| Replies: 17 Views: 1,022 The wittingly wrong statement in OP code is delete buffer; - must be delete[]buffer;. Yet another defect: insufficient error check-up.
long GetFileSize(ifstream &file)
{
static const... |
Forum: C++ Jun 12th, 2009 |
| Replies: 4 Views: 310 Are you sure that your method is not efficient?
Why?..
What's your efficiency criterion? |
Forum: C++ Jun 12th, 2009 |
| Replies: 6 Views: 352 Of course, all possible in C++ ;)
That's an improvisation:
/// suite.h (class Suite definition)
class Suite
{
public:
Suite() {}
Suite(const Suite& suit):value(suit.value) {}
... |
Forum: C++ Jun 11th, 2009 |
| Replies: 6 Views: 481 >I want the minimal pointer because it is the left most node for my tree.
The leftmost node in the tree is not the same as the minimal pointer!
Moreover, a pointer value does not bear a relation to... |
Forum: C++ Jun 9th, 2009 |
| Replies: 7 Views: 405 >i checked for Nov and for Dec
Hmm... For December the code returns a wrong answer months(0)...
Well, the right answer is:
currentMonth % 12 + 1
;) |
Forum: C++ Jun 8th, 2009 |
| Replies: 13 Views: 560 Try to append LL suffix to long long constants. |
Forum: C++ Jun 6th, 2009 |
| Replies: 4 Views: 312 for (int i = 0; i < 20; i++) |
Forum: C++ Jun 5th, 2009 |
| Replies: 2 Views: 257 What's an excited title for help request: I don't know!!...
Next time try to invent more sensible phrase...
It's a well-known ;) fact that
lcm(a,b) = (a/gcd(a,b))*b
where gcd means greatest... |
Forum: C++ Jun 1st, 2009 |
| Replies: 4 Views: 306 Step by step instruction:
1. Start Visual Studio
2. Select Help | Index
3. Type LNK2001 in Look For field
4. Click on LNK2001 list element
5. Read about LNK2001 error
6. Error correction:... |
Forum: C++ Jun 1st, 2009 |
| Replies: 18 Views: 890 >I am talking about the programming interface ArkM, it is drag and drop just like VB
>I'm out of this thread, tired of being treated like a dumbass.
I hope now you will have a time to read Qt... |
Forum: C++ May 31st, 2009 |
| Replies: 6 Views: 356 Didn't you familiar with logical not operator?
if (!*fileName)
// or
if (fileName[0] == '\0')
// or
if (strlen(fileName) == 0)
By the way, fileName == "" is equal to false in all cases.... |
Forum: C++ May 31st, 2009 |
| Replies: 3 Views: 313 It's legal to compare any pointer value with null pointer or any others pointer values of the same type.
Better post your code fragment with segmentation fault. It's annoying to download the whole... |
Forum: C++ May 30th, 2009 |
| Replies: 10 Views: 589 I have found this exotic Number_1_C... panopticon at Ohio state university site. It looks like an attempt to convert the C++ language to an incomprehensible slang for dedicated persons. As far as I... |
Forum: C++ May 30th, 2009 |
| Replies: 4 Views: 464 You can deallocate dynamically allocated memory here, there and everywhere:
int main()
{
al = new Vertex*[numLocations];
...
delete [] al; // al is visible
...
// or
f(al); //... |
Forum: C++ May 29th, 2009 |
| Replies: 3 Views: 512 Yes, old good (or most likely bad) VC++ 6.0 can't compile String member template from std_lib_facilities.h. However why #include "iostream" instead of <iostream>?
Better try to download and... |
Forum: C++ May 29th, 2009 |
| Replies: 6 Views: 215 I was trying to understand what's the ASCII value of a string of text (about 10 seconds or even more)... Alas... Can you explain what is it?
Now I see why you cannot seem to figure out how to... |
Forum: C++ May 29th, 2009 |
| Replies: 16 Views: 651 iamthwee.thank(you).for(post(number(2)));
;) |
Forum: C++ May 26th, 2009 |
| Replies: 12 Views: 517 tux4life, don't torment the unhappy C++ programmer, tell him/her about while(f>>i) construct ;) |
Forum: C++ May 26th, 2009 |
| Replies: 3 Views: 276 cout << r[0] << r[1] or cout << r.substr(0,2)
;) |
Forum: C++ May 24th, 2009 |
| Replies: 15 Views: 617 Please, post your code with code tag:
source
Read this forum announcement: http://www.daniweb.com/forums/announcement8-3.html |
Forum: C++ May 18th, 2009 |
| Replies: 4 Views: 533 Try winbgim or winBGI libraries - BGI for Windows (search Google).
Regrettably (or fortunately), I have never used these libraries... |
Forum: C++ May 18th, 2009 |
| Replies: 10 Views: 526 Place this function into the separate .cpp file:
void ShowText(const char* filename)
{
::ShellExecuteA(::GetDesktopWindow(),
"open",
"notepad.exe",
filename,
... |
Forum: C++ May 17th, 2009 |
| Replies: 27 Views: 2,044 What's a nightmare! Have you ever seen a simplest book on programming languages syntax?..
>an expression is an assignment to a variable like...
What is an expression in C++:
It's NOT an... |
Forum: C++ May 16th, 2009 |
| Replies: 5 Views: 300 Use pointers:
class A // Better use capitalized names for your classes
{
public: // Better place public interface first
A():inFile(0),report(0) {}
void setinput(std::ifstream& in) { inFile... |
Forum: C++ May 16th, 2009 |
| Replies: 8 Views: 1,038 Read this: http://www.ddj.com/cpp/184401305 |
Forum: C++ May 14th, 2009 |
| Replies: 5 Views: 398 The answer: use anonymous namespace...
using std::cout;
class A // External linkage name
{
public:
void f() { cout << "::A:f()\n"; }
};
namespace { // Internal linkage area: |
Forum: C++ May 14th, 2009 |
| Replies: 2 Views: 677 >I looked on google ...
After ~15 seconds:
http://www.codeproject.com/KB/recipes/csha1.aspx
http://www.packetizer.com/security/sha1/
What's a problem? |
Forum: C++ May 11th, 2009 |
| Replies: 5 Views: 296 bool conjugated(const std::string& s1, const std::string& s2)
{
return s1.size() == s2.size() &&
(s1+ s1).find(s2) != std::string::npos;
}
;) |
Forum: C++ May 10th, 2009 |
| Replies: 22 Views: 908 Other failed tests:
f("\""); // Strip me!
ch = '\"'; // Strip me!
Probably, this is too much!(?) :
#if 0 |
Forum: C++ May 9th, 2009 |
| Replies: 6 Views: 407 Of course, operator ~. What's a shame :( Sorry. |
Forum: C++ May 3rd, 2009 |
| Replies: 39 Views: 1,313 You have used pointers in a[i] construct because a[i] <=> *((a)+(i)) by the language definition. You have used pointers in sort(int a[],... construct because an array argument converts to the pointer... |
Forum: C++ May 3rd, 2009 |
| Replies: 6 Views: 652 Take into account that
123456 * 654321 * 80779853 == 6525384681074833728
but std::numeric_limits<long>::max() is equal to 2147483647 on 32-bit processors (integer overflow is not detected).... |
Forum: C++ May 1st, 2009 |
| Replies: 19 Views: 824 /// fast int test (except possible overflow)
bool isInt(const std::string& s)
{
static const size_t npos = std::string::npos;
static const std::string digits("0123456789");
size_t... |
Forum: C++ Apr 28th, 2009 |
| Replies: 35 Views: 2,042 >...then you're working for the NSA...
That's it! (see my the 1st post in the thread above ;).
"Unpredictable" or "non-reproducible" sequences (it's not the same as "random") are used for... |
Forum: C++ Apr 24th, 2009 |
| Replies: 8 Views: 573 Of course, it's impossible to overload operator + for char* type ;)
It's overloaded for std::string:
std::string std::string::operator+(const char*) const;
;) |
Forum: C++ Apr 24th, 2009 |
| Replies: 18 Views: 1,114 Regrettably the OP question (and all the thread ;)) is a product of a misunderstanding of an array semantics in C++ (and C). If we have an array which is defined as int x[100] = {1,0,3}; then we have... |
Forum: C++ Apr 23rd, 2009 |
| Replies: 7 Views: 578 Output stream named infile... That's cool! ;) |
Forum: C++ Apr 16th, 2009 |
| Replies: 7 Views: 329 About the second point. I think that error message printing on too low level is a very harmful practice. In that case we have a chance to get a bucket of messages on a single failure. Besides that... |
Forum: C++ Apr 12th, 2009 |
| Replies: 35 Views: 1,942 ;)
bool isEven(const char* number)
{
bool even = false;
if (number) {
if (*number == '-' || *number == '+')
number++;
if (*number) {
even =... |