User Name Password Register
DaniWeb IT Discussion Community
All
What is DaniWeb IT Discussion Community?
DaniWeb is a massive community of 455,998 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 3,844 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 86
Search took 0.01 seconds.
Posts Made By: n1337
Forum: C++ Oct 7th, 2008
Replies: 5
Views: 222
Posted By n1337
Re: triangles of matrix

Oh, well in that case, how are you storing the matrix? Probably an array of numbers, I would guess.

If you are just starting, might be easiest to use a 2D array; declare an mxn array of integers...
Forum: C++ Oct 7th, 2008
Replies: 5
Views: 222
Posted By n1337
Re: triangles of matrix

Do you mean you need to print the LU factorization of the matrix?

if so, perhaps this (http://en.wikipedia.org/wiki/LU_decomposition) page might be of some assistance...
Forum: C++ Jul 29th, 2008
Replies: 6
Views: 324
Posted By n1337
Re: Object creation question

Well, if you want to get technical, it has to do with how you are referencing each object at the memory level (and understanding of this depends on how much you know about memory models). ...
Forum: C++ Jul 29th, 2008
Replies: 5
Views: 292
Posted By n1337
Re: Bool problem

Since Addition is a boolean value, you could also simply code:
if (Addition) { //do whatever }
That is of course unless you are attempting to make the boolean value true...which would defeat the...
Forum: C++ Jul 29th, 2008
Replies: 7
Views: 289
Posted By n1337
Re: I need help, wise sages...

yup yup of course in that case, if you ever computed a sum of 12 (two 6's), numInstances[sum] would actually be out of bounds (no error though, so be careful). So...you would have to store it in...
Forum: C++ Jul 28th, 2008
Replies: 8
Views: 322
Posted By n1337
Re: cAn some one help me and explain why this error occurs

lol dont redefine stuff. I said move the declarations around. To before where you use it. Before the loop. You already have the working code (I assume since that is what you said in a previous...
Forum: C++ Jul 28th, 2008
Replies: 8
Views: 322
Posted By n1337
Re: cAn some one help me and explain why this error occurs

Yes but you will need to change around some declarations (I.e. end and runningTime need to be declared before the loop). Also, I just copied your code from outside the loop because you said it was...
Forum: C++ Jul 28th, 2008
Replies: 8
Views: 322
Posted By n1337
Re: cAn some one help me and explain why this error occurs

Well, you could do something about it... In your for loop, do something like:


if (i%5000 == 0)
{
end = clock();
runningTime = (double) (end - start) / (double) CLOCKS_PER_SEC;

cout...
Forum: C++ Jun 30th, 2008
Replies: 7
Views: 1,619
Posted By n1337
Re: Difference between C and C++

Well...those links have a lot of the differences. I think basically C++ is an extension of C with added features. You can still use C code in C++, and code in a "C-Style", but C++ has features that...
Forum: C++ Jun 27th, 2008
Replies: 16
Views: 709
Posted By n1337
Re: 2 dimensional array construction

What have you tried so far? Any thoughts on the subject? Do you know how to declar a multidimensional array, or a single-dimensional array for that matter? Do you know what a conditional (if)...
Forum: C++ Jun 27th, 2008
Replies: 7
Views: 438
Posted By n1337
Re: Prime Patterns

Yes, Shaun is correct. However there is more...A related theorem says that every number is either prime itself, or else is a product of primes. I forget who proved this (Euclid?) but here is a...
Forum: C++ Jun 26th, 2008
Replies: 2
Views: 137
Posted By n1337
Re: please help my proj. tic-tac-toe

OK that is a really open ended question...Before I (or anyone else) can even begin to help, we need to know a few things:

1) When you say user to user, do you mean like across a network? On the...
Forum: C++ Jun 20th, 2008
Replies: 6
Views: 258
Posted By n1337
Re: Completely customised GUI?

I do apologize. Permit me to clarify:



I think I went on at length about how this might restrict the types of things you will be able to accomplish...until you get more experience/depending on how...
Forum: C++ Jun 20th, 2008
Replies: 6
Views: 258
Posted By n1337
Re: Completely customised GUI?

You know, it seems that introducing GUIs to the beginner programmer is a little bit like opening pandora's box. I mean, I'm not saying that in doing so we release all the evils of programming... It...
Forum: C++ Jun 19th, 2008
Replies: 3
Views: 274
Posted By n1337
Re: Good memory-practice site?

I literally googled "C++ memory management" and here is what I found:

one (http://www.cantrip.org/wave12.html?seenIEPage=1), two (http://www.mycplus.com/cplus.asp?CID=42), three...
Forum: C++ Jun 19th, 2008
Replies: 4
Views: 657
Posted By n1337
Re: map Vs simple array

A Hashmap is basically a combination of an array and a list:

Suppose you had a whole bunch of keys. The way a hashmap works is basically, you reduce the keys mod some fairly large prime number (say...
Forum: C++ Jun 6th, 2008
Replies: 25
Views: 3,149
Posted By n1337
Re: How do I reverse numbers in my program

ummm did you see the date? and it was already solved...
Forum: C++ Jun 6th, 2008
Replies: 7
Views: 491
Posted By n1337
Re: Memory Allocation Understanding, new []()

Right, I was compiling on VC++ 08...I think it looks cleaner this way too.

Anyway, it didn't even cross my mind that it would be parsed as a binary shift...

And I actually meant that, in the...
Forum: C++ Jun 6th, 2008
Replies: 7
Views: 491
Posted By n1337
Re: Memory Allocation Understanding, new []()

I do believe it is just:

vector <vector<string>> myvec;



You could do something like this:


vector <vector<string>> myvec(10, vector<string>(10));
Forum: C++ Jun 5th, 2008
Replies: 2
Views: 221
Posted By n1337
Re: need help understanding the problem

I think you generate 100 random numbers in the range 1 to 200, and store them in an array.

Then you do 100 searches, each time generating a new random number, and using this newly generated random...
Forum: C++ May 28th, 2008
Replies: 11
Views: 441
Posted By n1337
Re: Recursion

Just so you know, if you write *crafty* recursive code, a.k.a. tail recursive functions, your compiler should optimize for recursion and use less stack space (i.e. reuse stack space)...the equivalent...
Forum: C++ May 28th, 2008
Replies: 11
Views: 441
Posted By n1337
Re: Recursion

edit: how to delete a multiple post...
Forum: C++ May 25th, 2008
Replies: 6
Views: 2,496
Posted By n1337
Re: something to do about multiplying two dimensional arrays!!!!!

Please look at the date before reviving old threads...you are late by almost 2 years...
Forum: C++ May 24th, 2008
Replies: 1
Views: 322
Posted By n1337
Re: implementation os stack

LIFO.

Stack using arrays...? It might be a better exercise to implement a stack struct (that can be easily resized and whatnot). But if you really want...then I guess we could work through one...
Forum: C++ May 24th, 2008
Replies: 5
Views: 510
Posted By n1337
Re: deleting an element in a linked list

Sorry I didn't realize this hadn't been solved. I don't have time atm (I'll be out and about all day...), but I will sit down later tonight and help you out, unless someone else has fixed up your...
Forum: C++ May 23rd, 2008
Replies: 8
Views: 241
Posted By n1337
Re: Not Quite Sure How I Would Do This?

Essentially you are extending the triangular number sequence: 1, 3, 6, 10, 15, ... (i.e. each number is the number of asterisks printed so far). Here is the...
Forum: C++ May 23rd, 2008
Replies: 11
Views: 1,415
Posted By n1337
Re: Draw shapes in C++

Right, well, I'm not sure I understand what you are asking...

Which shapes do you need to learn how to draw? Just a square/triangle? That would be where I would start...

Assuming your exam is a...
Forum: C++ May 23rd, 2008
Replies: 11
Views: 955
Posted By n1337
Re: Diagram in C++

C# and C++ have very similar syntax (C# came after, and is based on Java and by extention C++). C# was designed around the .NET framework (which I actually really like, from what I...
Forum: C++ May 23rd, 2008
Replies: 3
Views: 290
Posted By n1337
Re: Another Bank Account class

What do you mean? What specifically are you having difficulty with...Also, does your code compile? If not, where are the issues...



If you are bent on making console menus, you may be interested...
Forum: C++ May 23rd, 2008
Replies: 11
Views: 1,415
Posted By n1337
Re: Draw shapes in C++

Or else you do a few math calculations, then set up a function to draw individual shapes....

For example, you could create a "square" function:


void draw_square(int sideLength);


which basically...
Forum: C++ May 22nd, 2008
Replies: 3
Views: 293
Posted By n1337
Re: panel

Perhaps you need to update the label text as you update the progress bar value...in the same iteration...
Forum: C++ May 22nd, 2008
Replies: 1
Views: 208
Posted By n1337
Re: Checking string content

I'm afraid that, even if you found some function in some library somewhere, it's implementation would still be O(n) (where n is the number of characters)....After all, a string is just an array of...
Forum: C++ May 22nd, 2008
Replies: 4
Views: 240
Posted By n1337
Re: need help in stack within stack....

I tend to think with pointers because I started with C...and pointers are commonplace in C...and thats how I learned...lol. But my thoughts were this: the elements in a stack may in fact be objects...
Forum: C++ May 22nd, 2008
Replies: 4
Views: 240
Posted By n1337
Re: need help in stack within stack....

I have a potential solution...though you may not like it (and I haven't fully implemented it, so there could be some leaks):

1) In your stack class, in the private field, in the node struct, change...
Forum: C++ May 22nd, 2008
Replies: 2
Views: 188
Posted By n1337
Re: When to use pointer and when not??

The difference is just in the way you are storing them, at the memory level. For example, suppose you had the following memory model:


Address Contents
... ...
Forum: C++ May 21st, 2008
Replies: 19
Views: 1,107
Posted By n1337
Re: Problems dividing a number

Well, you could use the idea of integer division, i.e. a|b ("a divides b"), and remainders...

So for example, we say "3 divides 10" 3 times, with a remainder of 1. So you could take the floor of...
Forum: C++ May 21st, 2008
Replies: 19
Views: 1,107
Posted By n1337
Re: Problems dividing a number

absolutely you can do this. As was stated previously, you can explicitly tell C++ to hold onto the decimal portion. For example:


int n1 = 10;
int n2 = 3;

cout << (double)n1/n2 << endl;

//Note: ...
Forum: C++ May 21st, 2008
Replies: 9
Views: 455
Posted By n1337
Re: Elementary Class/const Question

Pass by reference works much the same as passing an array in Java. In fact, when you supply an array as an argument in Java, you don't actually copy the array, you just pass the address (believe it...
Forum: C++ May 21st, 2008
Replies: 4
Views: 243
Posted By n1337
Re: Debugging - input validation

This is exactly what you should expect. C++ implicitly converts (or rather truncates) the decimal portion to the integer. It is equivalent to using a floor() function..

So if you try to stick...
Forum: C++ May 21st, 2008
Replies: 4
Views: 243
Posted By n1337
Re: Debugging - input validation

Unless I'm missing something, I think you answered your own question here...after all, integers are not real numbers or rational numbers (i.e. no decimals allowed). They are simply all the numbers...
Showing results 1 to 40 of 86

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