User Name Password Register
DaniWeb IT Discussion Community
All
What is DaniWeb IT Discussion Community?
DaniWeb is a massive community of 423,169 software developers, web developers, Internet marketers, and tech gurus who are all enthusiastic about making contacts, networking, and learning from each other. In fact, there are 4,434 IT professionals currently interacting right now! Registration is free, only takes a minute and lets you enjoy all of the interactive features of the site.
Showing results 1 to 40 of 62
Search took 0.01 seconds.
Posts Made By: Ptolemy
Forum: Software Developers' Lounge Nov 2nd, 2007
Replies: 5
Views: 958
Posted By Ptolemy
Re: Managed C++ and C++/CLI Queries

>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 counted...
Forum: C++ Nov 2nd, 2007
Replies: 2
Views: 524
Posted By Ptolemy
Re: Mmorpg

>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: 1,592
Posted By Ptolemy
Re: C++ Hashing functions?

>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: 5,645
Posted By Ptolemy
Re: Copy argv to string in C(newbie question)

>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: 2,450
Posted By Ptolemy
Re: Concatenation of strings without string.h

>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: 1,382
Posted By Ptolemy
Re: back in the good ol days??

>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 do...
Forum: C Nov 1st, 2007
Replies: 1
Views: 793
Posted By Ptolemy
Re: Matrix sorting and factorial

>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: 5,645
Posted By Ptolemy
Re: Copy argv to string in C(newbie question)

>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: 3,297
Posted By Ptolemy
Re: warning:Warning: assignment from incompatible pointer type

>I feel like a dumbass for writing such bad code
It's not that bad... :-/
Forum: C Oct 31st, 2007
Replies: 7
Views: 3,297
Posted By Ptolemy
Re: warning:Warning: assignment from incompatible pointer type

>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: 718
Posted By Ptolemy
Re: Please Help Dynamic Memory Allocation.

>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: 1,441
Posted By Ptolemy
Re: Best language for writing OMR program?

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: 718
Posted By Ptolemy
Re: Please Help Dynamic Memory Allocation.

>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
Views: 2,044
Posted By Ptolemy
Re: c++ scores

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: 12
Views: 1,245
Posted By Ptolemy
Re: xor linked list

>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: 383
Posted By Ptolemy
Re: Quick Question!

>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
Views: 2,044
Posted By Ptolemy
Re: c++ scores

>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 blank,...
Forum: C++ Oct 25th, 2007
Replies: 12
Views: 1,245
Posted By Ptolemy
Re: xor linked list

>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*. You...
Forum: C++ Oct 25th, 2007
Replies: 12
Views: 1,245
Posted By Ptolemy
Re: xor linked list

>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
Views: 2,245
Posted By Ptolemy
Re: fibonacci

>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
Views: 2,044
Posted By Ptolemy
Re: c++ scores

>...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: 1,256
Posted By Ptolemy
Re: Multiple Scanf's Issue

>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: 330
Posted By Ptolemy
Re: double and float......

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: 528
Posted By Ptolemy
Re: subtract 2 signed bianry numbers

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
Views: 2,245
Posted By Ptolemy
Re: fibonacci

>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 can...
Forum: C Oct 25th, 2007
Replies: 4
Views: 595
Posted By Ptolemy
Re: English to piglatin help!

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
Views: 2,245
Posted By Ptolemy
Re: fibonacci

>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 array...
Forum: C++ Oct 23rd, 2007
Replies: 2
Views: 336
Posted By Ptolemy
Re: Help

>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: 2,045
Posted By Ptolemy
Re: scanf discussion

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 contrived...
Forum: C Oct 23rd, 2007
Replies: 7
Views: 2,045
Posted By Ptolemy
Re: scanf discussion

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 for a...
Forum: C++ Oct 23rd, 2007
Replies: 4
Views: 2,214
Posted By Ptolemy
Re: Cast double to const char*

>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: 2,045
Posted By Ptolemy
Re: Integer Value!

>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: 977
Posted By Ptolemy
Re: help

>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: 977
Posted By Ptolemy
Re: help

>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: 957
Posted By Ptolemy
Re: Problem with atan2() abs()

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: 977
Posted By Ptolemy
Re: help

>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: 397
Posted By Ptolemy
Re: binary

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 ( "Enter a...
Forum: C++ Oct 22nd, 2007
Replies: 2
Views: 1,330
Posted By Ptolemy
Re: calling system clock?

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: 1,697
Posted By Ptolemy
Re: calculate car speed (mph) using speed of light

>.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: 792
Posted By Ptolemy
Re: Need Help Solving a Complex Class

>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

 
All times are GMT -4. The time now is 8:03 am.
Forum system based on vBulletin Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
©2003 - 2008 DaniWeb® LLC