Search Results

Showing results 1 to 40 of 65
Search took 0.01 seconds.
Search: Posts Made By: GloriousEremite
Forum: C++ Mar 23rd, 2007
Replies: 14
Views: 5,409
Posted By GloriousEremite
Right, it is part of the current standard, but such C functions might be removed in the future (and a new standard is due out in the next couple years)
Forum: C++ Mar 23rd, 2007
Replies: 14
Views: 5,409
Posted By GloriousEremite
According to the standard, the c header files are deprecated, meaning they might be removed from the standard in future revisions.
Forum: C Nov 22nd, 2006
Replies: 15
Views: 3,021
Posted By GloriousEremite
Entry *entry;
entry = new Entry(media, entertainment);

What are you trying to do here? You've already assigned the private members of the class (_media and _entertainment). And once the...
Forum: C++ Oct 20th, 2006
Replies: 6
Solved: operator()
Views: 1,390
Posted By GloriousEremite
In addition, you may want to search for "functor" or "function object" for more information.
Forum: C++ Oct 15th, 2006
Replies: 13
Views: 3,109
Posted By GloriousEremite
It's not an "abnormality," it's actually part of the C++ standard. As I understand it, operators like 'and' and 'or' are included for users with different character sets. See:...
Forum: C++ Oct 12th, 2006
Replies: 3
Views: 3,221
Posted By GloriousEremite
Could you post a short program that demonstrates the problem (and that we can actually compile)?
Forum: C++ Oct 9th, 2006
Replies: 8
Views: 6,371
Posted By GloriousEremite
The first part looks ok to me, but for the second part you also need to allocate space for each pointer in the array
Forum: C++ Oct 9th, 2006
Replies: 7
Views: 4,674
Posted By GloriousEremite
Since it appears you are using managed (.NET) code, why not use the .NET classes for file IO? I'm no expert at C++/CLI but it might be as simple as:

System::IO::StreamWriter^ sw = gcnew...
Forum: C++ Oct 7th, 2006
Replies: 3
Views: 2,739
Posted By GloriousEremite
If you're going to use std::find like that, you need to define an equality operator for your info class:

class Info
{
public:
bool operator==(const std::string& first_name);
//...
}
...
Forum: C++ Oct 7th, 2006
Replies: 7
Views: 6,278
Posted By GloriousEremite
Do you mean the length of a c-style string (char array) or the length of a std::string? You could use strlen for the former, and the length() member function for the latter
Forum: C++ Oct 7th, 2006
Replies: 4
Views: 2,329
Posted By GloriousEremite
What do you expect to happen? After you increment 'p' in your third loop, it points past the last element of the array, so you're bound to get garbage data on your last outputs.
Forum: C++ Oct 4th, 2006
Replies: 7
Views: 1,389
Posted By GloriousEremite
Try indenting/using code tags (some IDEs can even indent for you!):

#include <iostream>
#include <string>
#include <iomanip>
using namespace std;
int main()
{
// Declare Variables
...
Forum: C++ Oct 3rd, 2006
Replies: 19
Views: 2,989
Posted By GloriousEremite
Think about it this way (ignore the total for now):


End of Month 1: Adults - 1, Babies - 0
End of Month 2: Adults - 1, Babies - 1
End of Month 3: Adults - 2, Babies - 1 <-- Number of adults...
Forum: C++ Oct 3rd, 2006
Replies: 10
Views: 3,688
Posted By GloriousEremite
One of those little errors, it appears:

for ( int i = 0; i < 13; i++ ); //<--semicolon

See if that works when you remove the trailing semicolon.

As a side note, you should probably prefer...
Forum: C++ Oct 2nd, 2006
Replies: 10
Views: 3,688
Posted By GloriousEremite
hand appears to be a 2-dimensional array, in which case you need to compare each element (if you use only one subscript, you're comparing a pointer to an integer)


if (hand[i][0]==1 &&...
Forum: C++ Oct 2nd, 2006
Replies: 19
Views: 2,989
Posted By GloriousEremite
First thing you probably want to do is write out more of that table (incidentally, I just recognized that sequence). Once you can describe the pattern, it shouldn't be too hard to replicate it.
...
Forum: C++ Oct 2nd, 2006
Replies: 2
Views: 3,063
Posted By GloriousEremite
Any particulary reason you're writing procedural code in C++? A better approach would be to create a tree class that handles everything.

Anyways, one major problem you have is that you pass a...
Forum: C++ Oct 2nd, 2006
Replies: 19
Views: 2,989
Posted By GloriousEremite
Is that table correct? I would think that you should start with two rabbits, then the number should double each month (i.e., exponential growth of 2^x)
Forum: C++ Oct 1st, 2006
Replies: 7
Views: 2,945
Posted By GloriousEremite
Your code shouldn't even compile. You're missing a using declaration (I assume) and main should return 'int'

Also, you should use std::stringstream instead of strstream (I believe the latter is...
Forum: C++ Sep 29th, 2006
Replies: 5
Views: 2,619
Posted By GloriousEremite
I believe static variables will be automatically initialized to zero or with their default constructor (and someone correct me if I'm wrong) if you don't specify, so it shouldn't be necessary. It's...
Forum: C++ Sep 23rd, 2006
Replies: 8
Views: 11,619
Posted By GloriousEremite
Are you using microsoft's managed extensions for C++ (.NET in VS 2003)? You might want to consider using C++/CLI instead for .NET programming (you can download Visual C++ 2005 Express for free). Keep...
Forum: C++ Sep 22nd, 2006
Replies: 5
Views: 1,569
Posted By GloriousEremite
Looks like a decent start. You just need to find a way to get the correct subscript into 'deck' to assign values in the inner loop, and then figure out how to shuffle the deck. The simplest way to do...
Forum: C++ Sep 18th, 2006
Replies: 6
Views: 1,794
Posted By GloriousEremite
How exactly are you linking this? I see you have two entry points (in pointTypeImp.cpp and circleTypeImp.cpp) and circleTypeImp.cpp relies on code from pointTypeImp.cpp. Obviously, though, you aren't...
Forum: C Sep 18th, 2006
Replies: 3
Views: 3,850
Posted By GloriousEremite
Well, it seems likely the problem is in one of the two parameters you pass to the LoadBitmap function. You should check the return value of GetLastError after LoadBitmap fails, and look it up here...
Forum: C++ Sep 15th, 2006
Replies: 4
Views: 2,515
Posted By GloriousEremite
Maybe there's a problem with your compiler/IDE installation or with the header files.

Also, make sure your code is being compiled as C++ and not C
Forum: C Sep 12th, 2006
Replies: 2
Views: 1,478
Posted By GloriousEremite
Some more info can be found here: http://msdn.microsoft.com/library/default.asp?url=/library/en-us/winprog/winprog/windows_data_types.asp

Namely, it says that WINAPI and CALLBACK are both defined...
Forum: C++ Sep 12th, 2006
Replies: 8
Views: 11,619
Posted By GloriousEremite
Look at std::ifstream (http://www.cplusplus.com/ref/iostream/ifstream/). E.g.:

#include <fstream>
#include <string>
//...
std::ifstream infile("somefile");
if (!infile.good())
{
//failed to...
Forum: C++ Sep 11th, 2006
Replies: 4
Views: 1,418
Posted By GloriousEremite
How about reformmating that/adding code tags?
Forum: C Sep 11th, 2006
Replies: 1
Views: 1,698
Posted By GloriousEremite
Try pressing alt-tab. It might appear elsewhere as well, but I can't think of where at the moment.
Forum: C Sep 11th, 2006
Replies: 5
Views: 2,390
Posted By GloriousEremite
SendMessage(GetDlgItem(hwnd, IDC_STATUSBAR), SB_SETTEXT, 255, (LPARAM)(LPSTR)"Ready");

The WPARAM argument should be a zero-based index (with 255/SB_SIMPLEID it probably assumes the control is a...
Forum: C++ Sep 10th, 2006
Replies: 6
Views: 2,111
Posted By GloriousEremite
Well, just because I think it's good practice doesn't make it so. Sometimes people say that not specifying a return value for main is nonstandard, which it isn't.

Just nitpicking, really.
Forum: C++ Sep 10th, 2006
Replies: 6
Views: 2,111
Posted By GloriousEremite
> with a return 0 at the end of the program, as defined by the C++ Standard.

Actually, return 0 is implicit for main() if a return statement is omitted. It's probably still good practice to...
Forum: C Sep 10th, 2006
Replies: 5
Views: 2,390
Posted By GloriousEremite
Could you post a short example program that we can compile, and that demonstrates the problem?
Forum: C++ Sep 9th, 2006
Replies: 5
Views: 1,678
Posted By GloriousEremite
Visual Studio? Try Linker->System->Subsystem (/SUBSYSTEM:WINDOWS)

Although I can't guarantee there aren't other options that are normally set for a Win32 project, and I don't know why you would...
Forum: C++ Sep 9th, 2006
Replies: 5
Views: 1,678
Posted By GloriousEremite
Make sure you created a Win32 project and not a console project (how to do that depends on your IDE)
Forum: C++ Sep 7th, 2006
Replies: 2
Views: 942
Posted By GloriousEremite
open expects a c-style string. You can use the c_str() std::string member function:

InObj.open(fname.c_str());
Forum: C++ Aug 31st, 2006
Replies: 6
Views: 1,758
Posted By GloriousEremite
You might be able to use a pointer instead. E.g.:

#include <iostream>

const int ARRAY_SIZE = 5;
int array1[] = {1,2,3,4,5};
int array2[] = {6,7,8,9,10};
int* arrays[] = { array1, array2 };...
Forum: C++ Aug 31st, 2006
Replies: 1
Views: 3,291
Posted By GloriousEremite
MailCarrier's default constructor tries to implicitly call the base class (Employee) constructor. You need to either define a constructor for Employee that takes no arguments, or explicitly call the...
Forum: C Aug 30th, 2006
Replies: 50
Views: 8,303
Posted By GloriousEremite
> One more thing, if i can't call main() recursively, can u suggest me any other way to call the main just after finish other function.

You don't need to call main; when your function finishes,...
Forum: C++ Aug 29th, 2006
Replies: 2
Views: 6,555
Posted By GloriousEremite
'person' is a map of maps, not a Person_class, so naturally it won't have those members. person["somestring"]["somestring"] would return (or set) a Person_class, however, so trying:
...
Showing results 1 to 40 of 65

 


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

©2003 - 2009 DaniWeb® LLC