Forum: C Jun 3rd, 2009 |
| Replies: 3 Views: 320 I would clean up the printf a bit by making it more readable. Also I am not sure why you are passing the argument "&menu" to your printf. Its incorrect in this context.
Something like this would... |
Forum: C Oct 21st, 2008 |
| Replies: 6 Views: 531 A void function would generally look like this
void foo(){
return;
}
But trying to do this is wrong. |
Forum: C Oct 21st, 2008 |
| Replies: 3 Views: 823 Pass them in as pointers from your calling function.
void fbExeCode(int BldCnt, char* fCodeAddr, char* tmpAddr){
}
A few things to be careful about. If you want to allocate them in... |
Forum: C Oct 14th, 2008 |
| Replies: 10 Views: 862 Here (http://www.planetoid.org/technical/samples/va_args/va_args.c) is an example of a printf using va_args. |
Forum: C Oct 9th, 2008 |
| Replies: 1 Views: 363 Take a look at your previous post here (http://www.daniweb.com/forums/thread149899.html) . |
Forum: C Oct 8th, 2008 |
| Replies: 8 Views: 612 this is interesting
char* toPLString(char * inputstring){
char *toPLString = inputstring;
....
}
your function and your pointer have the same name :?: |
Forum: C Oct 8th, 2008 |
| Replies: 14 Views: 1,050 Try to open the file in the append mode "a+t" |
Forum: C Oct 8th, 2008 |
| Replies: 14 Views: 1,050 I am a little confused with all the file opening .. first you open Users.txt in your main() function .. then you open it again in your sign-up function. Is there a specific purpose to that ?
And... |
Forum: C Oct 7th, 2008 |
| Replies: 4 Views: 663 You should be able to redirect using the > and the >> operators.
myExe > output.txt |
Forum: C Oct 7th, 2008 |
| Replies: 3 Views: 729 You should remove your scanf statements from the if {} and move them to under the while loop
Something like this will keep looping until you have the correct number. Or you could restrict the... |
Forum: C Oct 7th, 2008 |
| Replies: 4 Views: 616 A recursive palindrome is pretty simple, here is my attempt at the pseudo-code for it.
function isPalindrome(char* str, int len):
if len <= 1:
return true; // we have a palindrome
... |
Forum: C Oct 6th, 2008 |
| Replies: 8 Views: 1,125 Your variable "result" in not defined in the gcd() function. Also you need to return the result value. |
Forum: C Oct 6th, 2008 |
| Replies: 8 Views: 1,125 This
{
int result,a;
if a = 0 return b
while b ≠ 0
if a > b
a := a − b
else |
Forum: C Oct 6th, 2008 |
| Replies: 8 Views: 1,125 Well you are printing "result" without initializing it or assigning it a value. Is result supposed to be your GCD ? Then you probably want to move your print to after you have computed your GCD and... |
Forum: C Oct 3rd, 2008 |
| Replies: 9 Views: 1,640 Modulo will work. If you are using an int to store your binary value make sure that you check the upper limits of the maximum integer value. If you want to be able to store larger values, then you... |
Forum: C Oct 3rd, 2008 |
| Replies: 9 Views: 1,640 The const means that you cannot modify the contents of the char.
In your case, since you are asking the user to input the binary value, so you do not want to make it a const , since you will be... |
Forum: C Oct 3rd, 2008 |
| Replies: 4 Views: 630 Oh I see those now :) .. I do need to look closer |
Forum: C Oct 3rd, 2008 |
| Replies: 4 Views: 630 You probably want to put a break after each case statement in your switch ? otherwise it will just go onto the next one
switch (number){
case 1:
break;
case 2:
break;
......
} |
Forum: C Oct 3rd, 2008 |
| Replies: 9 Views: 1,640 unsigned int value would be your decimal value.
The
static const char *binary
is a list of binary values that are being converted to their decimal equivalent. In your case you are getting... |
Forum: C Oct 3rd, 2008 |
| Replies: 7 Views: 591 lol .. I am always amazed by such questions .. there is complex stuff and then there are just idiotic unreasonable expectations and this falls in the latter category.
how on earth do you expect... |
Forum: C Oct 2nd, 2008 |
| Replies: 3 Views: 572 Does your code compile ?
One thing I notice is that bool space=true; .. bool is a C++ data type. |
Forum: C Sep 30th, 2008 |
| Replies: 6 Views: 644 I think what you are trying to do is insert values in a doubly linked list in alphabetical order by the last name ?
if so, you aren't going about it correctly .. lets assume you have a set of 5... |
Forum: C Sep 30th, 2008 |
| Replies: 2 Views: 1,432 What you are doing will work i.e. RF_RXTXPAIR_SETTINGS code RF_SETTINGS[2];
If you want to dynamically assign an array size at runtime, you could do
RF_SETTINGS = malloc (number_of_elements *... |
Forum: C Sep 30th, 2008 |
| Replies: 5 Views: 518 A genogram would be fairly complex, but I think you could use a combination of a tree and a linked list to store it .. |
Forum: C Sep 30th, 2008 |
| Replies: 5 Views: 518 Use a structure
struct familyRecord{
char* name;
char* birthDate;
int isMarried;
int nChildren;
. |
Forum: C Sep 29th, 2008 |
| Replies: 3 Views: 2,967 You already have an example.. try to use that to work out an algorithm
For eg:
inorder is : 2 3 4 5 6 7 8
preorder is : 5 3 2 4 7 6 8
then the Binary tree shld be
________5
________/\... |
Forum: C Sep 26th, 2008 |
| Replies: 3 Views: 409 You need to give us more information. Can you post the link errors that you get ?
Make sure that you have the correct prototypes in the .h files and that you are including the correct .h files... |
Forum: C Sep 25th, 2008 |
| Replies: 4 Views: 1,118 Yeah it should be "t:" and if t is an optional argument it should be "t::"
why don't you like getopt ? |
Forum: C Sep 25th, 2008 |
| Replies: 5 Views: 906 You could try using valgrind on Linux to see if you have any memory errors. See http://valgrind.org/. |
Forum: C Sep 25th, 2008 |
| Replies: 3 Views: 416 gcc allows the // comments. The only compiler I have come across which doesn't allow // on C code is the AIX C compiler. |
Forum: C Sep 25th, 2008 |
| Replies: 10 Views: 1,977 paths is a pointer, as per your definition.
path_info *paths
When you do
global_routing_info[i].paths = (path_info *) malloc ( sizeof ( path_info ) );
You now have an array of paths. |
Forum: C Sep 24th, 2008 |
| Replies: 4 Views: 713 Perhaps this may help ? here (http://en.wikipedia.org/wiki/Wikipedia:Algorithms_on_Wikipedia) :) |
Forum: C Sep 24th, 2008 |
| Replies: 10 Views: 1,977 To access an element of the array "paths", you need to use the notation . not ->
so its
global_routing_info[neighbor].paths[no_paths].path_id = path; |
Forum: C Sep 23rd, 2008 |
| Replies: 7 Views: 667 well your main function should be
int main(){
return 0;
}
Also EOF is a reserved macro. So call yours something else like "NEWLINE" or such. |
Forum: C Sep 22nd, 2008 |
| Replies: 6 Views: 621 A couple of things.
One, as per your problem definition, the user inputs the monthly charges for electric and water sewer.
So your total for 15 years for these two utilities would be... |
Forum: C Sep 22nd, 2008 |
| Replies: 6 Views: 621 Your tax rate for each year will be something like:
YearlyTaxRate = intial_cost * tax_rate;
Your current code states
tax_rate = ? * initial_cost;
total =... |
Forum: C Sep 22nd, 2008 |
| Replies: 3 Views: 472 To compute the average atomic weight, you have to compute the total atomic weight and the total number of atoms.
For example :
totalAtomicWeight = (O*o)+(C*c)+(N*n)+(S*s)+(H*h);
... |
Forum: C Sep 22nd, 2008 |
| Replies: 3 Views: 472 You will need to save the atomic weights for each element. For instance
double OxygenAtom = 15.994
Then compute the total atomic weight for each element depending on the number of atoms, and... |
Forum: C Sep 21st, 2008 |
| Replies: 19 Views: 2,009 Thanks for answering that Ancient Dragon :) .. I was attempting to give a logical answer .. but don't think its getting through :confused: |
Forum: C Sep 20th, 2008 |
| Replies: 7 Views: 4,501 You could also initialize a float using
float a = 0.1f;
The f tells the compiler that its a float. |