Search:

Type: Posts; User: AmbliKai

Page 1 of 3 1 2 3

Search: Search took 0.01 seconds.

  1. Replies
    16
    Views
    3,046

    Thanks for the guide! I've just found why i...

    Thanks for the guide!

    I've just found why i can't use getbalance() as a local variable. At least at one point.

    the code:


    if(iterate(balance, (guess / 1200), 0, payment_fixed, 0) <...
  2. Replies
    16
    Views
    3,046

    Yeah, i'm kinda new to this and self taught, i...

    Yeah, i'm kinda new to this and self taught, i tried to indent it but i'm probably not really getting the idea! Could you suggest how to do it properly? (i should really have a search on the net!)If...
  3. Replies
    16
    Views
    3,046

    I had something similar originally. But i thought...

    I had something similar originally. But i thought i'd need a global variable otherwise it would keep asking for input whenever the function was called. So i defined a global variable and used that...
  4. Replies
    16
    Views
    3,046

    Thanks for the reply!! Its things like that...

    Thanks for the reply!!
    Its things like that which make me realise how new i am to this!

    I've done something similar to your idea now, with a while loop in main.

    So my code is now:

    ...
  5. Replies
    16
    Views
    3,046

    2 really good ideas! Thanks! I don't know how...

    2 really good ideas! Thanks!

    I don't know how i would make the program go back to the beginning though?
    Put the whole thing in a while loop? But would each case in the switch have to set a flag...
  6. Replies
    16
    Views
    3,046

    Ok, just as i thought, i was being a bit daft...

    Ok, just as i thought, i was being a bit daft with my function calls. Instead of doing:



    float getbalance(void)
    {
    float balance;
    printf("Enter balance.\n");
    scanf("%f",...
  7. Replies
    16
    Views
    3,046

    Ok thanks! I hope people will have a brief look:...

    Ok thanks!
    I hope people will have a brief look:



    #include<stdio.h>

    float getbalance(void)
    {
    float balance;
  8. Replies
    16
    Views
    3,046

    Help me optimise my code!

    Hi everyone, as an aside to the sudoku thing i was trying, i wrote a program to calculate various aspects of a debt. (It was mainly an exercise in using functions)

    Anyway, it works and i think i'm...
  9. Replies
    13
    Views
    7,282

    Thanks for the replys guys. I think maybe its...

    Thanks for the replys guys.

    I think maybe its too difficult at the moment to have a dynamic array. I don't even know where to begin with that!!

    I'll stick to a fixed array and see how i get on...
  10. Replies
    13
    Views
    7,282

    Ah ok, i think i understand. So malloc() isn't a...

    Ah ok, i think i understand. So malloc() isn't a way to access the array directly, just a method to reserve enough dynamic memory to the potential array?

    So as a simple example... if i did:

    ...
  11. Replies
    13
    Views
    7,282

    Thanks! I started it purely as a learning...

    Thanks!

    I started it purely as a learning exercise. I don't see the point in following tutorials etc unless you're actually using the code in a problem. So i set myself a problem and set about...
  12. Replies
    13
    Views
    7,282

    Wow, replying quicker than i can type! Thanks! ...

    Wow, replying quicker than i can type! Thanks!

    So then how would i refer to specific parts of the array?



    int *board;

    board = malloc(width * width * 9);
  13. Replies
    13
    Views
    7,282

    Well the board would be width x width in size and...

    Well the board would be width x width in size and each square would have a maximum of 9 possibilities.

    Thats how i was going to store the values. Is there a better way do you think?

    Also i...
  14. Replies
    13
    Views
    7,282

    malloc, structures, arrays and sudoku!!

    Hi everyone,

    A while ago i wrote a program to solve a sudoku board by way of learning to program in C. It worked and i learned a lot (and caught the bug!)
    Now i'm looking at improving it.
    ...
  15. Replies
    2
    Views
    2,142

    Ah thanks! You're a legend! Interestingly, i...

    Ah thanks! You're a legend!

    Interestingly, i had it as char selection; to begin with but that wouldn't work so changed it to int.

    Thanks a lot!
    Kai.
  16. Replies
    2
    Views
    2,142

    case switch not working

    Hi guys,

    I was just writing a wee program to calulate APR on a credit card, i was going to use a case statement, so did a bit of reading and looked at some examples, seems simple but i can't get...
  17. Replies
    5
    Views
    4,029

    Thanks for your reply, Tha part where i set x...

    Thanks for your reply,
    Tha part where i set x is because i want the array (i.e the number of inputs) to be any size. Thats why i tried inputs[x]. I set x just because i wanted to get the gist of...
  18. Replies
    5
    Views
    4,029

    Truth tables and binary

    Hi everyone, its been a while since i last posted, i started teaching myself C a while ago and i'm trying to get back to it. Been really busy at work with fun languages like Ocean!

    Anyway, i like...
  19. Replies
    5
    Views
    2,001

    Thanks a lot for your help but i've abandoned it!...

    Thanks a lot for your help but i've abandoned it! Really in the spirit of learning! ;)

    Did it with a bash script instead.

    Cheers
  20. Replies
    5
    Views
    2,001

    it doesn't seem to keeo the shell variables. Even...

    it doesn't seem to keeo the shell variables. Even if i stick to bourne shell. ie:



    system("W_DIR=2amp/eps/3m6to10m; export W_DIR");

    The variable is forgotten directly after the above command!
  21. Replies
    5
    Views
    2,001

    Thanks, i tried saving the path info in variables...

    Thanks, i tried saving the path info in variables but i can't seem to get it to work. I'm using tcsh and the c program seems to be implementing all my system calls in bourne shell. How do i change it...
  22. Replies
    2
    Views
    8,493

    System calls in c

    Hi Everyone. I'm having problems with system calls, basically the commands that i can put into my terminal are fine but don't work as system calls from c.
    I'm using tcsh.
    In other words:

    (23)...
  23. Replies
    5
    Views
    2,001

    Basic system calls help.

    Hi Everyone, its been a little while since i posted, been lurking though!

    I'm writing a short program to try and sift through a mountain of data from some simulation results.

    Basically, the...
  24. Replies
    16
    Views
    2,457

    so i'd be as well just typing it out each time? ...

    so i'd be as well just typing it out each time?

    There are a lot of places in my program where i use the above construct. with code sometimes after x or y etc.
    Its not bad programming practice to...
  25. Replies
    16
    Views
    2,457

    I don't even know how to use function pointers!...

    I don't even know how to use function pointers! Think i'll stick to macros just now!

    I've already started converting my program over to using macros! :D
Results 1 to 25 of 68
Page 1 of 3 1 2 3