Search Results

Showing results 1 to 40 of 426
Search took 0.04 seconds.
Search: Posts Made By: ArkM ; Forum: C++ and child forums
Forum: C++ Jun 16th, 2009
Replies: 9
Views: 495
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 15th, 2009
Replies: 4
Solved: Organising code
Views: 311
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: 412
Posted By ArkM
Insert std::cin.ignore(1000,'\n'); after std::cin >> diameter;
Forum: C++ Jun 15th, 2009
Replies: 11
Views: 412
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: 11
Views: 412
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: 5
Views: 413
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: 402
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: 413
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: 17
Views: 1,021
Posted By ArkM
If so, mark this thread as solved ;)
Forum: C++ Jun 14th, 2009
Replies: 2
Views: 282
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: 17
Views: 1,021
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: 1,021
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 12th, 2009
Replies: 6
Views: 352
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: 352
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: 352
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: 308
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: 352
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 11th, 2009
Replies: 16
Solved: Bits in a byte
Views: 745
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: 6
Solved: Return pointer
Views: 481
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...
Forum: C++ Jun 11th, 2009
Replies: 16
Solved: Bits in a byte
Views: 745
Posted By ArkM
>not many people will ever touch something like a 4-bit machine or any other sort of setup.
None the less there were supercomputers with 6-bits and 9-bits (or may be 12) bytes ;)
Moreover, I have...
Forum: C++ Jun 11th, 2009
Replies: 6
Solved: Return pointer
Views: 481
Posted By ArkM
>I dont want the data inside i want the pointer
Which pointer do you want (and why) - that's a question ;)

If you want the minimal pointer value ( why?! ) - you have it. What's a problem? Well,...
Forum: C++ Jun 11th, 2009
Replies: 6
Solved: Return pointer
Views: 481
Posted By ArkM
Probably you want a pointer which points to the minimal data value. In actual fact it's (as usually) senseless operation to compare pointer values. Moreover, the result of pointers comparison is...
Forum: C++ Jun 8th, 2009
Replies: 13
Views: 560
Posted By ArkM
Try to append LL suffix to long long constants.
Forum: C++ Jun 8th, 2009
Replies: 13
Views: 556
Posted By ArkM
>What do you mean? All memmove does is move memory. So even if you want to use your own class object, it should still work.
It's so simple. Suppose the object has a member which is a head of double...
Forum: C++ Jun 8th, 2009
Replies: 13
Views: 556
Posted By ArkM
William, we don't know base element type. If it's a class object (see OP), memmove can't move elements correctly! Moreover, remove class object means call destructor...
Forum: C++ Jun 8th, 2009
Replies: 6
Views: 366
Posted By ArkM
Of course, the original post is extremely ill-formed.
However at least one defect arrests attention: sort_names function is wrong. Sorting loop index is out of range: names[j+1] refers to...
Forum: C++ Jun 8th, 2009
Replies: 13
Views: 556
Posted By ArkM
Too many problems on a single (and simple) program case is a symptom of bad design solution.

Evidently in that case you need different data structure. You want dynamically defined data structure...
Forum: C++ Jun 8th, 2009
Replies: 3
Views: 487
Posted By ArkM
Initialization of class members (except static integral types):

class Ob // avoid all small letters names
{
public: // declare public then protected then private
Ob():name("Name") {} //...
Forum: C++ Jun 7th, 2009
Replies: 7
Views: 411
Posted By ArkM
>the program encrypts the text at a rate of about 5000 characters per second on a 500mhz Intel Pentium 3 running windows xp pro.
It looks like an extremely low speed. I think that's a lower bound of...
Forum: C++ Jun 4th, 2009
Replies: 11
Solved: Object trouble
Views: 437
Posted By ArkM
It's so interesting: what's your context? There is a wonderful context: Internet. For example:
http://www.cprogramming.com/tutorial/stl/stlmap.html
and lots of other links to std::map tutorials......
Forum: C++ Jun 4th, 2009
Replies: 11
Solved: Object trouble
Views: 437
Posted By ArkM
It's so easy: use std::map<std::string,planet>.
Forum: C++ Jun 3rd, 2009
Replies: 4
Views: 250
Posted By ArkM
1. Probably you mean doesn't promote -1 to unsigned int...
2. All this happens in int a = (int)-1 * x. The funny part is: (int)-1 is the same as -1 because an integer literal already (and always)...
Forum: C++ Jun 3rd, 2009
Replies: 4
Views: 954
Posted By ArkM
Try to understand the standard compilation process logic.

Simplified translation process description:

1. Every .cpp file is processed separately (as if no other cpp files)

2. Preprocessor...
Forum: C++ Jun 2nd, 2009
Replies: 6
Views: 686
Posted By ArkM
Place your struct type definition in .h file:

struct Points {
int xCoordinate;
int yCoordinate;
int zCoordinate;
};
... global functions prototypes

Include this .h file in all...
Forum: C++ Jun 2nd, 2009
Replies: 4
Solved: help with loops
Views: 208
Posted By ArkM
And where are data declarations?
;)
Please, Read This Before Posting: http://www.daniweb.com/forums/thread78223.html
Forum: C++ Jun 2nd, 2009
Replies: 4
Solved: help with loops
Views: 208
Posted By ArkM
Where is the code?
Forum: C++ Jun 1st, 2009
Replies: 2
Views: 735
Posted By ArkM
Of course, you can't access protected method in main! Only member functions of derived classes can access protected members.
Re-read your C++ textbook...
Forum: C++ Jun 1st, 2009
Replies: 3
Views: 549
Posted By ArkM
May be it helps (see modf function: split integer and fractional parts):

/**
* 2008-10-01 Beta version. No warranties...
* Rounding functions freeware mini-package.
* About rounding forms...
Forum: C++ May 31st, 2009
Replies: 6
Views: 354
Posted By ArkM
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: 6
Views: 354
Posted By ArkM
Keep it simple:

fileName[0] = '\0';
// or even
*fileName = 0;
// to test:
if (*fileName) { // non-empty

;)
Showing results 1 to 40 of 426

 


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

©2003 - 2009 DaniWeb® LLC