Search Results

Showing results 1 to 40 of 234
Search took 0.06 seconds.
Search: Posts Made By: ~s.o.s~ ; Forum: C++ and child forums
Forum: C++ Jul 26th, 2007
Replies: 6
Views: 2,482
Posted By ~s.o.s~
Why do you want to return a 2D array which is a member of the class when all you are doing in the 'population()' method is make changes to the same array? You can just call the 'population()'...
Forum: C++ Jul 25th, 2007
Replies: 6
Views: 2,482
Posted By ~s.o.s~
You can either pass the array considering as a sparse array i.e. by doing void someFunc(int** myArray) or you can pass it as a normal array by leaving off at the max the first dimension i.e. void...
Forum: C++ Jul 19th, 2007
Replies: 30
Solved: Chess Program
Views: 6,889
Posted By ~s.o.s~
> did anyone ask you bench?
Bad attitude. First in another thread and now this one. If you keep up this, I don't think you would be getting any help.

Always learn with an open mind and smile on...
Forum: C++ Jul 19th, 2007
Replies: 6
Views: 18,598
Posted By ~s.o.s~
Bench has given a good suggestion. But if you are not allowed to use maps, try using two parallel string arrays in which the location of the name of the animal and its description resides in the same...
Forum: C++ Jul 17th, 2007
Replies: 11
Views: 1,355
Posted By ~s.o.s~
Right shifting 1 by 8, 16 or 24 times isn't going to get you anywhere. After a single right shift, the number will become 0 and 'AND'ing it with any number would make no difference. Oh and BTW, 0XF...
Forum: C++ Jul 17th, 2007
Replies: 62
Solved: Permutation
Views: 11,215
Posted By ~s.o.s~
A function with a base case(the terminating condition) and a recursive case, calling itself is known as Recursion. So whats basically happening in the above case is that to tackle the problem of the...
Forum: C++ Jul 16th, 2007
Replies: 62
Solved: Permutation
Views: 11,215
Posted By ~s.o.s~
Dump the loops, what you need is a recursive algorithm which would work for arbitrary lengths of arrays. One of the way is using 'Heap Permute'. Here is a sample program which you can easily adapt to...
Forum: C++ Jul 15th, 2007
Replies: 30
Solved: Chess Program
Views: 6,889
Posted By ~s.o.s~
libsdl is a better choice than BGI since it has a host of functions and has better tutorials and support on the internet than BGI. Considering that you have one entire month for making the game, you...
Forum: C++ Jul 11th, 2007
Replies: 7
Solved: size of arrays
Views: 5,043
Posted By ~s.o.s~
> there is a function in c++ called strlen() which tells you the length of an array
That would only be for char arrays, not any array.
Forum: C++ Jul 11th, 2007
Replies: 53
Views: 9,040
Posted By ~s.o.s~
Every object you create can have a draw method, which will know how to render itself on the screen. So you just need to call the draw method of each object in a loop for all objects in the game. The...
Forum: C++ Jul 11th, 2007
Replies: 53
Views: 9,040
Posted By ~s.o.s~
No, that won't work. Destruction of a class object has got nothing to do with the display. You would anyways need to actually 'erase' the thing which is on the screen. Thus your logic would consist...
Forum: C++ Jul 11th, 2007
Replies: 53
Views: 9,040
Posted By ~s.o.s~
Like I said before, you need to read the function reference which is inbuilt in Turbo C to find it out since I have never worked with such things. Read something related to view ports concepts in...
Forum: C++ Jul 11th, 2007
Replies: 53
Views: 9,040
Posted By ~s.o.s~
I am sorry I highlighted the wrong part.

The statement you ought to change is: string[25] = '/0';. It should be string[25] = '\0';, which is a null terminator.
Forum: C++ Jul 11th, 2007
Replies: 53
Views: 9,040
Posted By ~s.o.s~
You should try to copy and paste the exact code provided to you, at least till you get the concepts right.

I pasted:

for(int i=0;i<24-1;i++)
{
string[i] = getch();
}
You wrote:
Forum: C++ Jul 11th, 2007
Replies: 53
Views: 9,040
Posted By ~s.o.s~
Why a null terminator after each character input? I guess it was a typo.

char string[100];
for(int i=0;i<100-1;i++)
{
string[i] = getch();
}
string[i+1] = '\0';
Forum: C++ Jul 9th, 2007
Replies: 53
Views: 9,040
Posted By ~s.o.s~
I am afraid I don't know a lot about Turbo C graphics library and its specific functions. But for erasing the previous figure and redrawing it at a new location, consider erasing the particular part...
Forum: C++ Jul 8th, 2007
Replies: 53
Views: 9,040
Posted By ~s.o.s~
Read this (http://users.aber.ac.uk/auj/voidmain.shtml). Simple and short answer: As far as the standards are concerned, main() always has returned an int as its exit status.
Forum: C++ Jul 8th, 2007
Replies: 53
Views: 9,040
Posted By ~s.o.s~
This is happening because you are setting the fill color as well as the border color of the fill to the same color i.e. RED.

This is confusing the floodfill algorithm which checks the color of the...
Forum: C++ Jul 8th, 2007
Replies: 53
Views: 9,040
Posted By ~s.o.s~
Maybe posting the entire code in code tags would help your cause.
Forum: C++ Jul 7th, 2007
Replies: 53
Views: 9,040
Posted By ~s.o.s~
Any point inside any closed figure.
Forum: C++ Jul 7th, 2007
Replies: 53
Views: 9,040
Posted By ~s.o.s~
You first need to draw the cirle and then do a flood fill, not after it. Swap the 'circle' and 'floodfill' statements.
Forum: C++ Jul 3rd, 2007
Replies: 5
Views: 12,435
Posted By ~s.o.s~
A real world use of two dimensional arrays is for representing matrices. Here is an example of 3 x 3 identity matrix:

int matrix[3][3] = {0};
for(int i = 0; i < 3; ++i)
{
for(int j = 0; j <...
Forum: C++ Jul 2nd, 2007
Replies: 18
Solved: Insertion Sort
Views: 7,507
Posted By ~s.o.s~
Why pre-declare variables when C++ doesn't mandate it and anyways you are not using 'i' outside the loop?
Forum: C++ Jul 2nd, 2007
Replies: 18
Solved: Insertion Sort
Views: 7,507
Posted By ~s.o.s~
Every C program is a valid C++ program.(except for the deprecated header declarations). C++ is the functional superset of C. It seems that you need to read a few good C++ tutorials and books to get...
Forum: C++ Jun 29th, 2007
Replies: 18
Views: 2,175
Posted By ~s.o.s~
Since the frequency is initialized with 0 and can hold a maximum value of 5, we can also write:

if(frequency != 5)
cout << "\nThere are" << frequency << " number of your prediction that...
Forum: C++ Jun 23rd, 2007
Replies: 7
Solved: date
Views: 808
Posted By ~s.o.s~
Zandiago, by now, you should have learned how to use code tags.

Enclose your code in //your entire code here tags. The case is important.
Forum: C++ Jun 22nd, 2007
Replies: 9
Views: 3,067
Posted By ~s.o.s~
Your concepts seem to be shaky.

OpenGL and DirectX are API's, or simply put, libraries which you can use in your program to render graphics on the screen. There are other alternatives, but these...
Forum: C++ Jun 21st, 2007
Replies: 9
Views: 3,067
Posted By ~s.o.s~
> I have the basic knowledge in C++ and C.
Better start off with some console based games. They would help you in concentrating on the logical aspects of the game without wasting your time in...
Forum: C++ Jun 17th, 2007
Replies: 3
Solved: do loop?
Views: 1,612
Posted By ~s.o.s~
Its not a 'do' statement. Its called a 'do..while' loop, much like the 'while' loop except that the enclosing block is guaranteed to run at least once.


int i = 0;
while(i)
{
//some code,...
Forum: C++ Jun 17th, 2007
Replies: 2
Solved: Linked lists
Views: 776
Posted By ~s.o.s~
You must ask specific questions, one at a time.

Linked List (http://en.wikipedia.org/wiki/Linked_list) is a type of data structure in which data is stored in nodes and each node points to the next...
Forum: C++ Jun 15th, 2007
Replies: 8
Solved: c and postgres
Views: 2,439
Posted By ~s.o.s~
Ah, scrap the sqlapi, it just offers a trial version unless you order it, so I guess it is out.

The only option left with you is to download the API provided by PostgreSQL instead. This...
Forum: C++ Jun 15th, 2007
Replies: 8
Solved: c and postgres
Views: 2,439
Posted By ~s.o.s~
Are you allowed to use third party API's in your project? If so, then try using sqlapi (http://www.daniweb.com/forums/www.sqlapi.com/), a C++ library for connecting to SQL databases.
Forum: C++ Jun 15th, 2007
Replies: 23
Views: 9,011
Posted By ~s.o.s~
Post your latest code so that it would be easier for someone to help you out.
Forum: C++ Jun 14th, 2007
Replies: 7
Views: 1,520
Posted By ~s.o.s~
AFAIK, this is not the case. When a variable is declared, a block of memory is reserved for it and thats it. No default initialization is done. Its because of this we get junk values when we try...
Forum: C++ Jun 14th, 2007
Replies: 5
Views: 950
Posted By ~s.o.s~
You just need to add a newline the moment you have displayed four randoms.

for(int i = 0; i < 100; ++i)
{
if(i % 4 == 0)
putchar('\n');
cout << randomNumber;
}
Forum: C++ Jun 13th, 2007
Replies: 4
Solved: why link error
Views: 1,092
Posted By ~s.o.s~
..because you failed to provide an implementation for the non-virtual function.


class abc
{
public: virtual ~abc() {}
static void operator delete(void*) { /*do something*/}
};
int...
Forum: C++ Jun 12th, 2007
Replies: 10
Views: 1,374
Posted By ~s.o.s~
> But where did it get the arrows from? Was the iterator getting
> incremented beyond the number of players?
Your iterator was in an invalid state and you try to access it. Simple.

> Just...
Forum: C++ Jun 12th, 2007
Replies: 10
Views: 1,374
Posted By ~s.o.s~
Yet another classic example of why globals should be best avoided. The culprit here is the iterator variable 'iter' which you chose to share among all your function calls resulting in side effects....
Forum: C++ Jun 11th, 2007
Replies: 10
Views: 1,235
Posted By ~s.o.s~
I guess I got confused between array initializers and memset. Hmm..but I do vaguely recollect someone mentioning something similar a long time back on the newsgroups.
Forum: C++ Jun 11th, 2007
Replies: 10
Views: 1,235
Posted By ~s.o.s~
But int arr[BUFSIZ] = {0}; internally uses memset to actually perform its task.
Showing results 1 to 40 of 234

 


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

©2003 - 2009 DaniWeb® LLC