519 Posted Topics

Member Avatar for darkdai
Member Avatar for abhimanipal
0
97
Member Avatar for GamerXxX

@aranath In the code sample that you have given, it is possible that more than 1 enemy may be present in the sample spot. Also you want to use srand to randomize the order in which the random numbers are generated :) @GamerXXX is it fine if 2 enemies appear …

Member Avatar for GamerXxX
0
762
Member Avatar for bklearner

In the accept data function, write a bunch of cin statements and when the user enters the data, write all of it to the file.

Member Avatar for NathanOliver
0
259
Member Avatar for brad82

Well the lines array just has space to store the contests of the file. It does not have space to store the header. Secondly in C if you want to assign a string constant to an char array you want to do something of this sort char arr[]="This is a …

Member Avatar for Aia
0
110
Member Avatar for appunu

Or some thing of this sort [CODE]int main() { int a,b,c; scanf("%d\n%d\n%d",&a,&b,&c); printf("A is %d\nB is %d\nC is %d\n",a,b,c); return 1; } [/CODE] PS: Using scanf is a bad idea. The sooner you shift to fgets the better

Member Avatar for NP-complete
0
121
Member Avatar for emmas4impact

I saw this same question on this forum a couple of days ago ... Go thru the postings on this forum for last 2-3 days ....

Member Avatar for abhimanipal
0
119
Member Avatar for gameon
Member Avatar for Aia
0
193
Member Avatar for xenanovich

Print the value of the file descriptor. When I printed the value I got -1. One reason could be, as the article mentioned that I am unable to open the file due to lack of permissions. Have you taken care of this issue ?

Member Avatar for xenanovich
0
1K
Member Avatar for lionaneesh

When you are checking to see how many chars have been printed via fprint use the condition <=0 insteaad of < 0

Member Avatar for abhimanipal
0
138
Member Avatar for darkdai

Generating random strings as a whole is tough ... You could chose a random length and then chose random chars to fill that length

Member Avatar for Narue
0
122
Member Avatar for lionaneesh

In your scenario when ever the sender is sending some data, the last 2 chars will always be '\r' and the '\n'. So if I wanted to send ABC across the stream then I will send it across like this "ABC\r\n" In the receive function the code is reading the …

Member Avatar for abhimanipal
0
195
Member Avatar for ce0

Towards the end of your while loop(lines 83-84) you ask the user to chose between y/n but the variable that you have used for taking the input is an integer. So what happens is when the user enters y, scanf sees that it has received an char but the variable …

Member Avatar for Tellalca
0
4K
Member Avatar for krap_nek

Suppose x contains the id number that you are looking for [CODE]ptr= list; for(i=0;i<list->count;i++) { // If you find a match then break; // Else do nothing } if(i==list->size) // this means we went through the entire list and did not find a match[/CODE]

Member Avatar for Tellalca
0
118
Member Avatar for Freespider
Member Avatar for Alerwiali

What exactly is the problem ? When you say nothing is happening its really not that descriptive .... Are you able to open the input/output files ? Are you getting garbage o/p ? Are you getting compile time/ run time errors ? The more detail that you give about the …

Member Avatar for abhimanipal
-1
166
Member Avatar for rajsharma_85

I normally use fread to read from a file. But I am surprised to see none of you mentioned that method. Are there any known pitfalls in using fread ?

Member Avatar for Narue
0
206
Member Avatar for xaop

Probably you could use a switch statement ???? [url]http://msdn.microsoft.com/en-us/library/66k51h7a%28VS.80%29.aspx[/url]

Member Avatar for abhimanipal
0
112
Member Avatar for noobuser

Tell me some thing why are combinations like [B]bcanm[/B] allowed ? PS: I dont think you have spent any time working on your algorithm

Member Avatar for abhimanipal
0
88
Member Avatar for anuragcoder
Member Avatar for didi00

Dont use getment(). Use malloc instead to allocate memory. Google for the syntax of malloc

Member Avatar for didi00
0
353
Member Avatar for bazoka121

Open file 1 Open file 2 Read a string of n chars from file1 into array1 Read a string of n chars from file 2 into aray2 Compare array1 and array2. You will have to ignore spaces and new lines when you are trying to comapre

Member Avatar for abhimanipal
0
118
Member Avatar for MrDiaz

You have to make the parent wait for the child to die before killing itself. A simple solution will be to use wait(NULL) in the parent Now the parent waits for the child to die before terminating [CODE] int main() { int pid; pid = fork(); if (pid) { printf("I'm …

Member Avatar for MrDiaz
0
107
Member Avatar for farhanafzal

There is a logical error in your code. Check to see what code I have written and you will spot the error. [CODE]mult1=1; for(i=n;i<=m;i++) //loop till the m { mult=1; for(j=1;j<=i;j++)// for factorial { mult=mult*j; } mult1=mult1*mult; }[/CODE] PS: Avoid using scanf. It has lots of hidden problems. Shift to …

Member Avatar for nbaztec
0
232
Member Avatar for xenanovich

What is the objective of your program ? Are you supposed to read from a file, do some processing on the string and send the string across ? If yes then I think you are over complicating a simple program ?

Member Avatar for xenanovich
0
266
Member Avatar for tinanewtonart

You probably want to say [CODE]while(cAns=='y'||cAns=='Y') {}[/CODE] Also I think the expansion of while(cAns=='y'||'Y') should be while((cAns=='y')||'Y') which will always be true

Member Avatar for tinanewtonart
0
260
Member Avatar for didi00

When you create a file check the file handler to see if it is not null. Also I dont like the fact that you have forked thrice in the main program. When you call fork() you create an additional process.So after the first call to fork is executed there will …

Member Avatar for didi00
0
682
Member Avatar for sdinu96
Member Avatar for abhimanipal
0
112
Member Avatar for Tuyet Anh Pham

I dont agree with the logic of your + operator. I would do something of this sort [CODE]while(A.top!=NULL && B.top!=NULL) { sum= (A.top)->data + (B.top)->data; Z.push(sum); } while(A.top!=NULL) Z.push((A.top)->data); while(B.top!=NULL) Z.push((B.top)->data); [/CODE] So if the input is 123+ 50, you will have some thing of this sort Stack 1: 1,2,3 …

Member Avatar for Tuyet Anh Pham
0
311
Member Avatar for pineapple23

Switch can only accept integers and chars not strings. Get rid of the nested loops, you dont need so much complication for such a simple program You the program flow suggested by nbaztec

Member Avatar for amrith92
0
372
Member Avatar for gcardonav

Check out this link [url]http://forums.macosxhints.com/showthread.php?t=2023[/url] I think this should solve your problem

Member Avatar for abhimanipal
0
535
Member Avatar for baby_c

The problem is when you code of the sort [CODE]int i; printf("Enter val "); scanf("%d",&i);[/CODE] and you input the value 5, you are actually pressing 2 keys 5 and the enter key. The value 5 gets assigned to i but enter key is still present in the stream. Then in …

Member Avatar for Aia
0
174
Member Avatar for saravanan.cse

What have you got so far ? Are you a CS student ?And you are trying to get other people to do your programming assignment

Member Avatar for abhimanipal
0
70
Member Avatar for Tellalca

Yes I think you are correct. But I advise you to cement your understanding by using some example. For instance if I have the data 10,20,15, how will the code handle it ?

Member Avatar for Tellalca
0
92
Member Avatar for Peter The Rock

Can you be more specific of what kind of help do you need ? Are there compile time errors, run time errors or do you need help to design the algorithm ?

Member Avatar for Aia
0
141
Member Avatar for simmi...

Do you know how to create a binary tree ? It is the same principle, but instead of 2 children now you have 5 children. Also does the problem state any restrictions on how you have to insert the node ? In the sense does the tree have to be …

Member Avatar for abhimanipal
0
150
Member Avatar for westsider123

Around a week ago..some one posted a very similar question and it was answered (debated) in much detail. Just search for the question in the C forum

Member Avatar for abhimanipal
0
107
Member Avatar for ellenski

Your main function contains a while loop in which you check for which selection is made. But you do not increment the value of i. So if I were to chose option a 5 times, it will enter data in prson[0] only.

Member Avatar for kvprajapati
-4
298
Member Avatar for maryam ahmad

In addition to what has been suggested above, I would advise you to run the for loop from 0.....strlen(word) as opposed to 0....20

Member Avatar for maryam ahmad
-1
143
Member Avatar for myth_terry
Member Avatar for kavourdoukos

I node a similar question in one of the more recent posts. Did your question get solved there ?

Member Avatar for abhimanipal
0
116
Member Avatar for anuragcoder

The problem is in the winsock library. When you call functions from that library, you get linker error. Write a simple 2-3 line code calling a function from winsock library to check if your library is installed correctly

Member Avatar for Aia
0
127
Member Avatar for Sandhya212

There are 2 solutions to your problem. First which I believe is the more simpler one. Here you are dealing with a single pointer which points to the beginning of the array [CODE]int* test2 (int arr2[][4],int mul){ for (int i=0;i<2;i++){ for(int j=0;j<4;j++){ arr2[i][j]=arr2[i][j]*mul; } } return &arr2[0][0];//sending back the address …

Member Avatar for Sandhya212
0
459
Member Avatar for katmai539

find return a pointer to the location of the first =. Then copy the contents from after the = till end of string into a temporary buffer Return the temporary buffer

Member Avatar for katmai539
1
210
Member Avatar for jskelly
Member Avatar for ayushi agarwal

[QUOTE=ayushi agarwal;1224341] p.i = new getValue(); [/QUOTE] While I am sure your question must have been answered already, I am interested to know what does new getValue() do.

Member Avatar for jephthah
0
101
Member Avatar for mystb

Then to encrypt you use the formula C[i] = pow(M[i],e)mod n. Why are you using a for loop for this ? Similarly in the decrypt use the formula M[i] = pow(C[i],d). You dont need the for loop for that

Member Avatar for abhimanipal
0
202
Member Avatar for ims@123

I have worked with Neteeza before . I think you will find the information that you are looking for in the manual

Member Avatar for abhimanipal
0
72
Member Avatar for westsider123
Member Avatar for jephthah
0
427
Member Avatar for ubi_ct83

This is what I have understood so far.... When the value is 2 you are doing right circular shift and when the value is 3 you are doing left circular shift. You have some input How do you determine which values come into the result array ?

Member Avatar for ubi_ct83
0
85
Member Avatar for abhimanipal

Hello Everybody, I have a small doubt regarding how we can call constructors in a C++ class [CODE]class test { public: test() { cout<<"In test\n"; } }; int main() { test t1; test t2(); // This call does not give compile time error but does not call the constructor cin.get(); …

Member Avatar for abhimanipal
0
107

The End.