Forum: C++ Jun 16th, 2009 |
| Replies: 9 Views: 492 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,007 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: 308 Are you sure that your method is not efficient?
Why?..
What's your efficiency criterion? |
Forum: C++ Jun 12th, 2009 |
| Replies: 6 Views: 350 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: 477 >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 9th, 2009 |
| Replies: 18 Views: 854 A day ago csurfer's algorithm solved the problem. That's "pipelined" version:
int i, j = rand()%20;
for (i = 0; i < 20; i++)
array[i] = (i != j)*(rand()%9 + 1);
In addition:... |
Forum: C++ Jun 8th, 2009 |
| Replies: 13 Views: 552 Try to append LL suffix to long long constants. |
Forum: C Jun 7th, 2009 |
| Replies: 7 Views: 574 All except '\r' and (may be) quotes ;)
Do you really want to study C i/o basics on DaniWeb forum?
Better search for a good C i/o tutorial. There are lots of good links... |
Forum: C++ Jun 6th, 2009 |
| Replies: 4 Views: 310 for (int i = 0; i < 20; i++) |
Forum: C++ Jun 5th, 2009 |
| Replies: 2 Views: 255 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: 303 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: 879 >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 Jun 1st, 2009 |
| Replies: 10 Views: 565 >c is generally slow compared to other programming language.
>Just out of curiosity, what languages should be faster?
Assembler, fortran?
Look at these wonderful benchmarks:... |
Forum: C++ May 31st, 2009 |
| Replies: 6 Views: 349 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: 310 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: 547 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: 459 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: 499 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: 214 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: 638 iamthwee.thank(you).for(post(number(2)));
;) |
Forum: C++ May 26th, 2009 |
| Replies: 12 Views: 514 tux4life, don't torment the unhappy C++ programmer, tell him/her about while(f>>i) construct ;) |
Forum: C May 26th, 2009 |
| Replies: 6 Views: 406 >Or do you know the 'ultimate' way?
Why not?
char* condense(char* s)
{
if (s) {
char* p = s;
char* q = s;
/* (never write so:) */
do if (*p != ' ') |
Forum: C++ May 26th, 2009 |
| Replies: 3 Views: 273 cout << r[0] << r[1] or cout << r.substr(0,2)
;) |
Forum: C May 25th, 2009 |
| Replies: 6 Views: 406 Remember KISS principle: no need in temporary strings! ;) |
Forum: C++ May 24th, 2009 |
| Replies: 15 Views: 606 Please, post your code with code tag:
source
Read this forum announcement: http://www.daniweb.com/forums/announcement8-3.html |
Forum: C May 22nd, 2009 |
| Replies: 5 Views: 381 If you mean variable argument list, read this:
http://www.codeproject.com/KB/cpp/argfunctions.aspx?fid=15556&df=90&mpp=25&noise=3&sort=Position&view=Quick&select=1066108 |
Forum: C May 20th, 2009 |
| Replies: 18 Views: 803 Impossible!
Can you prove it? How many bytes per second is OK? What's i/o channels capacity?
Even if it's true: serious applications are never discussed on the forums like DaniWeb. True crucial... |
Forum: C++ May 18th, 2009 |
| Replies: 4 Views: 501 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: 18 Views: 803 /** Undestructive tokenizer.
@todo Add tsz < toksz test
*/
const char* getTok(const char* s, char* tok, int toksz, const char* delim)
{
if (s && *s) {
int dlen =... |
Forum: C++ May 18th, 2009 |
| Replies: 10 Views: 519 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,036 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: 294 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,014 Read this: http://www.ddj.com/cpp/184401305 |
Forum: C++ May 14th, 2009 |
| Replies: 5 Views: 393 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: 649 >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: 293 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: 900 Other failed tests:
f("\""); // Strip me!
ch = '\"'; // Strip me!
Probably, this is too much!(?) :
#if 0 |
Forum: C++ May 9th, 2009 |
| Replies: 6 Views: 403 Of course, operator ~. What's a shame :( Sorry. |
Forum: C May 8th, 2009 |
| Replies: 9 Views: 366 > guess i forgot about this particular epic battle...
It's not the echo of the epic battle, it's a regular untidiness ;)
See the language standard, for example: ...null character term used...
In... |