Search Results

Showing results 1 to 40 of 1000
Search took 0.12 seconds.
Search: Posts Made By: ArkM
Forum: C++ Jun 16th, 2009
Replies: 8
Views: 476
Posted By ArkM
What for this overcomplicated unclear code? What's a programming case where this nightmare required?

This thread was started from a very suspicious-looking remark The compiler forces me to do a...
Forum: C++ Jun 16th, 2009
Replies: 9
Views: 440
Posted By ArkM
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 16th, 2009
Replies: 6
Views: 277
Posted By ArkM
The most natural place for structures without tags is typedef declaration (it's the only place I've used anonymous structs ;)):

typedef struct
{
...
} Record;
...
Record rec;
Record*...
Forum: C++ Jun 16th, 2009
Replies: 8
Views: 476
Posted By ArkM
Apropos, your fix_name is wrong. It does nothing (except memory leak).

You modify dynamically allocated copy of the string argument then assign the pointer to the parameter (but not to the...
Forum: C++ Jun 16th, 2009
Replies: 3
Views: 226
Posted By ArkM
And yet another question to OP:
Why you are starting a new thread on the same problem?
Orphaned thread:
http://www.daniweb.com/forums/thread197527.html
;)
Forum: C++ Jun 16th, 2009
Replies: 5
Views: 204
Posted By ArkM
No a proper constructor of the class SipDialogPublish.
Check up class SipDialogPublish definition and types of constructor arguments in the line #343. Probably this constructor was declared but not...
Forum: C++ Jun 16th, 2009
Replies: 3
Views: 226
Posted By ArkM
Yet another tip:

while (infile) // wrong loop!
{
getline(...);
... >> ...
i++
}

See what happens if the file is empty or after the last line reading:
Forum: C++ Jun 15th, 2009
Replies: 1
Views: 245
Posted By ArkM
Try to adopt this improvisation:

const size_t allbut = std::numeric_limits<int>::max();
bool overStep(std::istream& in)
{
char c;
while (in.ignore(allbut,'S')) {
do
...
Forum: C++ Jun 15th, 2009
Replies: 11
Views: 696
Posted By ArkM
Sorry, I have not noticed that you are in ubuntu environment...
It's not a problem in the Visual Studio debugger.
Forum: C++ Jun 15th, 2009
Replies: 4
Solved: Organising code
Views: 296
Posted By ArkM
Don't worry, it's a small code ;)
Try to split functions into separate groups by themes (as usually, it's possible to do). Place every group in a separate cpp file (don't forget to add it to the...
Forum: C++ Jun 15th, 2009
Replies: 11
Views: 696
Posted By ArkM
It's not an error at all. It's a simple info message. Fill the difference.
Forum: C++ Jun 15th, 2009
Replies: 11
Views: 383
Posted By ArkM
Insert std::cin.ignore(1000,'\n'); after std::cin >> diameter;
Forum: C++ Jun 15th, 2009
Replies: 11
Views: 383
Posted By ArkM
>...why is this i cannot see anything wrong with my code...
Oh, this harmful Daniweb engine! I see 'area' in the OP snippet but area in the post #3 code ;)
By the way, change char area; to float...
Forum: C++ Jun 15th, 2009
Replies: 5
Views: 498
Posted By ArkM
>...because if you just put a and b without quotes, the compiler will think that you are using the variables a and b.
That's exactly what OP intends to do ;)
Forum: C++ Jun 15th, 2009
Replies: 11
Views: 383
Posted By ArkM
Fill a glass with water (or what else) then drink, not vice versa ;)

Calculate a circle area AFTER its diameter request.
Output the area variable, not a wrong character literal 'area'...
Forum: C++ Jun 15th, 2009
Replies: 8
Views: 969
Posted By ArkM
After that place all system header includes in StdAfx.h (and remove them from .cpp files (after #include "StdAfx.h")...
Forum: C++ Jun 15th, 2009
Replies: 5
Views: 363
Posted By ArkM
>I'm not quite sure what exactly you mean. I'm really new to C++. Can you explain a bit more clearly?
OK, let's come back to the class Path design. The class has a member function without...
Forum: C++ Jun 15th, 2009
Replies: 8
Views: 384
Posted By ArkM
Well, your program crashed. It looks like a mere assertion, not a question.
Read This Before Posting: http://www.daniweb.com/forums/thread78223.html.
Never send exe files in attachments!
Forum: C++ Jun 15th, 2009
Replies: 5
Views: 363
Posted By ArkM
What a wonderful teleportation of argv[3] to every class Path object do you want? If you have a "default" starting point of the Path object (probably it's the scArg member), provide this class for a...
Forum: C++ Jun 15th, 2009
Replies: 2
Views: 241
Posted By ArkM
>I have found lots of ways to do this if I want all of the elements of the string but not how to do it when I only want certain parts.
What's a funny statement... If you can get all elements (by the...
Forum: C++ Jun 15th, 2009
Replies: 6
Views: 292
Posted By ArkM
Of course, it's not a stupid question but it's impossible to answer in a few words.
Look at
http://www.is.pku.edu.cn/~qzy/cpp/vc-stl/templates.htm...
Forum: C++ Jun 15th, 2009
Replies: 17
Views: 912
Posted By ArkM
If so, mark this thread as solved ;)
Forum: C++ Jun 14th, 2009
Replies: 2
Views: 252
Posted By ArkM
Better use std::string class:

#include <iostream>
#include <string>
using namespace std;
...
string day;
...
getline(cin,day);
if (day == "Mo") ...
Forum: C++ Jun 14th, 2009
Replies: 3
Views: 294
Posted By ArkM
Look at DISLIN (free for personal use):
http://www.mps.mpg.de/dislin/
Forum: C++ Jun 14th, 2009
Replies: 17
Views: 912
Posted By ArkM
1. Well, reserve size (if no need in some postprocessing)
2. Tastes differs; for example, I prefer to return bool in such cases. I think, returned size if more useful than 0. Moreover, zero on...
Forum: C++ Jun 14th, 2009
Replies: 17
Views: 912
Posted By ArkM
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 13th, 2009
Replies: 5
Views: 224
Posted By ArkM
See what a class of that sort (std::string surrogate) must have:

class Testing
{
public:
Testing();
Testing(const char*);
Testing(const Testing&); // copy constructor
Testing&...
Forum: C++ Jun 13th, 2009
Replies: 3
Views: 504
Posted By ArkM
Right direction but lots of defects in OP code.
The OP title does not bear a relation to the real OP problems.
Think about:

// Never fix array size in a function!
int getLargest(const int* a,...
Forum: C++ Jun 12th, 2009
Replies: 5
Views: 270
Posted By ArkM
There is a very strange syntax construct in your code:

switch (dom_destination)


do {
case 1:

Of course, it's an error, but syntactically switch statement in C and C++ looks as...
Forum: C++ Jun 12th, 2009
Replies: 6
Views: 329
Posted By ArkM
Your constructor variant with assignments has the same effect as mine. However as usually assignments in constructors (or even anywhere) are less effective than initialization with ctor-initializers...
Forum: C++ Jun 12th, 2009
Replies: 6
Views: 329
Posted By ArkM
In addition:
Change lines 40-45 in my code above to

/// more syntax sugar for lazies
const Suite
&Hearts = Suite::Hearts,
&Clubs = Suite::Clubs,
&Diamonds = Suite::Diamonds,
...
Forum: C++ Jun 12th, 2009
Replies: 6
Views: 329
Posted By ArkM
This part is so called ctor-initializer-list. In C++ it's a preferred way to initialize class members and the only method to pass constructor arguments to base class(es) constructors (the last...
Forum: C++ Jun 12th, 2009
Replies: 4
Views: 296
Posted By ArkM
Are you sure that your method is not efficient?
Why?..
What's your efficiency criterion?
Forum: C++ Jun 12th, 2009
Replies: 6
Views: 329
Posted By ArkM
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 12th, 2009
Replies: 6
Solved: Array question
Views: 358
Posted By ArkM
>...if you want to be a pedant...
To make distinctions between static, automatic and dynamic attributes - is it too pedantic for you?
;)
Forum: C Jun 12th, 2009
Replies: 8
Views: 766
Posted By ArkM
In C you can assign void* type pointer value to the pointer of any type without casting. So simply declare a proper type pointer and set it to the buffer:

char* pchar = buf_ptr;
char* ptr = pchar...
Forum: C Jun 12th, 2009
Replies: 6
Solved: Array question
Views: 358
Posted By ArkM
>short answer: static arrays are allocated when the function is called...
Short remark: static arrays are allocated before the first call of the function. However no static arrays in OP snippet....
Forum: C++ Jun 11th, 2009
Replies: 16
Solved: Bits in a byte
Views: 705
Posted By ArkM
>What evil being designed such a thing?!
Probably, it was the hardware architect's acute condition ;)
Many years ago...
Forum: C Jun 11th, 2009
Replies: 7
Views: 555
Posted By ArkM
The new-line character is defined in C, it's '\n'. The fgets standard library function retains a single new-line character from text mode streams only, but...
be careful:
Forum: C++ Jun 11th, 2009
Replies: 6
Solved: Return pointer
Views: 432
Posted By ArkM
>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...
Showing results 1 to 40 of 1000

 


About Us | Contact Us | Advertise | DaniWeb | Acceptable Use Policy | RSS Feed

©2003 - 2009 DaniWeb® LLC