Search Results

Showing results 1 to 40 of 62
Search took 0.01 seconds.
Search: Posts Made By: Ptolemy
Forum: IT Professionals' Lounge Nov 2nd, 2007
Replies: 5
Views: 1,472
Posted By Ptolemy
>But I heard it's now no longer in use.
Managed C++ was the precursor to C++/CLI. It's still in use, but for new code you should be using C++/CLI as it's vastly improved.

>C++/CLI could be...
Forum: C++ Nov 2nd, 2007
Replies: 2
Views: 951
Posted By Ptolemy
>I wanted to create a MMORPG.
That's waaaaaaay beyond you at the moment. Focus on learning C++ as best you can, but don't expect to be able to write an MMORPG anytime soon. You need a lot of...
Forum: C++ Nov 2nd, 2007
Replies: 2
Views: 5,991
Posted By Ptolemy
>I know the theory behind it but i dont seem to be able to put it into code!
Then you don't really know the theory behind it. ;) Not to be rude or anything, but these are all pretty straightforward...
Forum: C Nov 2nd, 2007
Replies: 19
Views: 13,142
Posted By Ptolemy
>you are assuming something about implementation dependent architecture
No, you're assuming that 50 is meaningful in telling you the length of the source string. The two examples are not equivalent...
Forum: C++ Nov 1st, 2007
Replies: 13
Views: 5,113
Posted By Ptolemy
>I just wanted to change the first character in the sentence to
>uppercase, what would I change to do that?
Don't call toupper on every character, just on the first one:

void printSentence(char...
Forum: Geeks' Lounge Nov 1st, 2007
Replies: 16
Views: 2,111
Posted By Ptolemy
>Do you think life would be better if we had start doing things the it ways years ago.
Life is what you make of it. Of course, you should completely define what you mean by "better". :)

>How long...
Forum: C Nov 1st, 2007
Replies: 1
Views: 1,650
Posted By Ptolemy
>wen i use larger values say 245323465 etc. the sorted matrix returned garbage values.. y s that?
Garbage values usually mean that you either didn't initialize the value in the first place, or you...
Forum: C Nov 1st, 2007
Replies: 19
Views: 13,142
Posted By Ptolemy
>i'm probably doing something basically wrong in the fubction maybe.
Are you passing any arguments to your program? If not, argv[1] isn't guaranteed to be there, and if it is, it's pretty much sure...
Forum: C Oct 31st, 2007
Replies: 7
Views: 9,415
Posted By Ptolemy
>I feel like a dumbass for writing such bad code
It's not that bad... :-/
Forum: C Oct 31st, 2007
Replies: 7
Views: 9,415
Posted By Ptolemy
>printf(head->data);
printf takes a string as the first argument, not an integer. You probably just forgot to add the format string, which would make the line look like this:

printf("%d\n",...
Forum: C++ Oct 25th, 2007
Replies: 4
Views: 1,336
Posted By Ptolemy
>Not any more -- C99 has changed that for C language
While C++ has a certain measure of compatibility with C, it's with C89, not C99. In C++, array sizes must be compile-time constants.
Forum: C++ Oct 25th, 2007
Replies: 11
Views: 2,529
Posted By Ptolemy
If you understood the problem well enough to actually write this program, you wouldn't need to ask what language is best. I'll go out on a limb and say you're in over your head at present.
Forum: C++ Oct 25th, 2007
Replies: 4
Views: 1,336
Posted By Ptolemy
>is dynamic memory allocation really necessaryÉ since you already
>know the size of the array which is being passed by the caller
Really? How do you know? If you're talking about the length...
Forum: C++ Oct 25th, 2007
Replies: 40
Solved: c++ scores
Views: 3,074
Posted By Ptolemy
Oh, don't read it as me bashing your solution, it's the same one I'd use. I was just mentioning that little pitfall because I'd noticed it while brainstorming. :)
Forum: C++ Oct 25th, 2007
Replies: 13
Solved: xor linked list
Views: 2,795
Posted By Ptolemy
>but don't know how to use cast. can you help me?
That's something that any C++ book or reference will tell you how to use. It would be "cast" or "type cast" in the index.
Forum: C++ Oct 25th, 2007
Replies: 5
Views: 628
Posted By Ptolemy
>since its not returning anything?
I don't understand. It's clearly returning something because the code that calls the function uses the return value:

kptr = function2( n ) ;

You can't use a...
Forum: C++ Oct 25th, 2007
Replies: 40
Solved: c++ scores
Views: 3,074
Posted By Ptolemy
>Once you have a student answer string you compare each element
>of that string with each element of the correct answer string
But from the sample file it looks like if the last N answers were...
Forum: C++ Oct 25th, 2007
Replies: 13
Solved: xor linked list
Views: 2,795
Posted By Ptolemy
>i found something but it has an error :"xor1001.cpp
>invalid conversion from `void*' to `link*' ".
You're compiling C as C++. C++ doesn't support implicit pointer conversions to and from void*....
Forum: C++ Oct 25th, 2007
Replies: 13
Solved: xor linked list
Views: 2,795
Posted By Ptolemy
>Doing a linked list using XOR ... I'm not certain what you mean.
It's a hack to avoid wasting extra space on links. It takes advantage of the butterfly effect using XOR. If you take the XOR of two...
Forum: C++ Oct 25th, 2007
Replies: 12
Solved: fibonacci
Views: 4,472
Posted By Ptolemy
>so changing the array to static solved everything.
No, changing the array to static and actually using the values you've cached solved everything. If you don't to the latter, your code won't be any...
Forum: C++ Oct 25th, 2007
Replies: 40
Solved: c++ scores
Views: 3,074
Posted By Ptolemy
>...Now where do i even begin?
You could use everything you've learned in your previous threads that do something similar.

>how do i store them so that the other lines are compared to it for the...
Forum: C Oct 25th, 2007
Replies: 3
Views: 2,897
Posted By Ptolemy
>try using %s in the scanf's
No, don't. At least don't until you know how to safely use %s and change the input variables to arrays. Otherwise you'll invoke undefined behavior and create security...
Forum: C Oct 25th, 2007
Replies: 1
Views: 538
Posted By Ptolemy
It's better to put the code directly in your post if it's short. The problem is that floating-point values aren't always exact, so you can't reliably test for equality. The usual fix for your problem...
Forum: C Oct 25th, 2007
Replies: 2
Views: 1,055
Posted By Ptolemy
If it's urgent, won't it be faster to write it yourself than wait for someone to send you something that may or may not work like you want? Also, if it's urgent, it's probably homework, and using...
Forum: C++ Oct 25th, 2007
Replies: 12
Solved: fibonacci
Views: 4,472
Posted By Ptolemy
>And remember, the C++ standard includes the C standard, more or less.
Standard C++ currently maintains compatibility with C89, not C99. So you can't use VLAs in C++

>Is my program the best it...
Forum: C Oct 25th, 2007
Replies: 4
Views: 1,261
Posted By Ptolemy
I'd start with the fact that functions can't be nested inside of each other in C. You're also calling letter before it's declared.
Forum: C++ Oct 24th, 2007
Replies: 12
Solved: fibonacci
Views: 4,472
Posted By Ptolemy
>What about a purely iterative solution, that does not need the excess
>memory, and is not logically limited in the number of values to display?
That's fine for just printing the sequence. The...
Forum: C++ Oct 23rd, 2007
Replies: 2
Views: 526
Posted By Ptolemy
>i am currently getting 3 errors
They're telling you that you can't use an array as the condition for a switch statement. You can only use integral values (or char, because char is an integral type).
Forum: C Oct 23rd, 2007
Replies: 7
Views: 4,340
Posted By Ptolemy
Just so we're clear. :)


Sloppy code is sloppy code, regardless of whether it's spawned from negligence or ignorance.


That's a safe bet. ;)


I guess I can't argue with carefully...
Forum: C Oct 23rd, 2007
Replies: 7
Views: 4,340
Posted By Ptolemy
I didn't realize you were the one who wrote those articles. :)


%s isn't the only way to read strings, but I'll take your point as talking only about %s without a field width.


So is printf...
Forum: C++ Oct 23rd, 2007
Replies: 5
Views: 7,347
Posted By Ptolemy
>I would like to know once and for all how to convert a double to a const char*
Casting doesn't work. You're not converting the double to a string with a cast, you're telling the compiler to use the...
Forum: C Oct 23rd, 2007
Replies: 7
Views: 4,340
Posted By Ptolemy
>I disagree. You have to have all kinds of special code to get scanf() to work properly.
Only if you aren't using scanf for what it was designed in the first place. When you have to write workaround...
Forum: C++ Oct 22nd, 2007
Replies: 23
Views: 1,653
Posted By Ptolemy
>can u write the code so i know wat i need to change?
If I write it for you then you wouldn't need to change anything anymore. ;) Here's a super huge hint though:

double payRate[size];
double...
Forum: C++ Oct 22nd, 2007
Replies: 23
Views: 1,653
Posted By Ptolemy
>in order to calculate wages, i have tried following
I noticed that hours and payRate weren't ever initialized in your earlier code. If you don't ever put anything in those arrays, you're going to...
Forum: C++ Oct 22nd, 2007
Replies: 9
Views: 1,815
Posted By Ptolemy
Do you really want to be casting away the precision when you call abs? Maybe you should be using fabs instead so that it gives you the absolute value without losing the precision.
Forum: C++ Oct 22nd, 2007
Replies: 23
Views: 1,653
Posted By Ptolemy
>Is it really necessary to write your application in C or C++?
It's probably an assignment for a C++ course, so yea, I imagine it's really necessary. Why do you ask?
Forum: C Oct 22nd, 2007
Replies: 3
Views: 578
Posted By Ptolemy
There's no way to print a binary value directly in C. You have to break the value up into bits and basically do it all manually:

#include <stdio.h>

int main ( void )
{
int x;

printf (...
Forum: C++ Oct 22nd, 2007
Replies: 2
Views: 2,689
Posted By Ptolemy
You can use the standard time library to do it, sort of:

#include <ctime>
#include <iostream>

void long_running_operation()
{
for ( unsigned i = 1; i != 0; i++ )
;
}
Forum: C++ Oct 22nd, 2007
Replies: 3
Views: 3,362
Posted By Ptolemy
>.533 microns converted to miles per hour = 3.311908
>.674 microns converted to miles per hour = 4.188042
Well, first, you need to remove the "per hour" part of that. The conversion is strictly...
Forum: C++ Oct 22nd, 2007
Replies: 1
Views: 1,707
Posted By Ptolemy
>This program is suppose to add, subtract, and print the complex numbers.
It'd be 100% easier if you used the standard complex stuff from the <complex> header. Despite the name, it's actually quite...
Showing results 1 to 40 of 62

 


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

©2003 - 2009 DaniWeb® LLC