Search:

Type: Posts; User: TobiasK

Search: Search took 0.00 seconds.

  1. Before I implement any changes, I want to make...

    Before I implement any changes, I want to make sure I understand what you are doing, as I will later have to account for my program and the things I've done with it.

    When it comes to structs, I...
  2. Are you using void for functions, which doesn't...

    Are you using void for functions, which doesn't require a specific type of variable input / output?

    Also, just noticed your comment inside the code. The code for male and female is not exactly the...
  3. I'm sorry, I was merely trying to simplify the...

    I'm sorry, I was merely trying to simplify the code you needed to see, while still being able to find the problem (of course, that is my inexperienced decision as to what to leave out).

    I am...
  4. Well, FileSave() just has a simple...

    Well, FileSave() just has a simple return-statement in the last line of code:


    char FileSave(gender)
    {
    [...]
    return BFpercent;
    }

    Yes, BFpercent is a global variable, double...
  5. What happens here? Variable value is deleted

    Here's my code:


    FileSave(); /* Returns the variable BFpercent, lets say 25.000 */
    printf("BFpercent is: %lf", BFpercent); /* Successfully prints BFpercent is: 25.000 */
    ...
  6. Replies
    9
    Views
    1,333

    Oooh yeah, bugger! Forgot that tiny & in the...

    Oooh yeah, bugger!

    Forgot that tiny & in the scan. All the small things! It seems to work now, after implementing vart's code.
  7. Replies
    9
    Views
    1,333

    What am I doing wrong here? It seems so simple,...

    What am I doing wrong here? It seems so simple, yet, it doesn't work.



    printf("%s", tekst); /* tekst is a string "Body fat percent is: 24.325" */
    sscanf(tekst, "%lf", BFpercent); /*...
  8. Replies
    9
    Views
    1,333

    Yeah, thats what I've heard is the best way to...

    Yeah, thats what I've heard is the best way to learn, which I've also tried to practice.. I made other adjustments for my program this evening and just needed to lay it off for a bit, so I thought a...
  9. Replies
    9
    Views
    1,333

    Right, I get the logic behind that. I can make it...

    Right, I get the logic behind that. I can make it read and scan the first line of my text document succesfully.
    How would you make it switch to the next line and repeat the process? A loop with a...
  10. Replies
    9
    Views
    1,333

    Theoretical question regarding text files

    Hello,
    I was just wondering whether or not it is possible to "mix" characters and integer values in a text document that is to be read by C.

    I am to read and use values for length around the hip,...
  11. Replies
    9
    Views
    1,216

    Strictly speaking I think #define true 1 is...

    Strictly speaking I think #define true 1 is pretty much what stdbool does, apart from other functionalities that it may have..

    Wanted to report back that I have fixed my problem and once again...
  12. Replies
    9
    Views
    1,216

    Well, JTG... Take my answer for what they are (I...

    Well, JTG... Take my answer for what they are (I too am inexperienced when it comes to C). Firstly, my teacher has set some perimeters for what is to be included in the program to show that we have...
  13. Replies
    9
    Views
    1,216

    Thank you both of you. I'm just stopping by...

    Thank you both of you. I'm just stopping by before work in a few min, but I'll make sure to take an in-depth look of your advices later today.

    Quick reply about _getch(), though, until now I too...
  14. Replies
    9
    Views
    1,216

    Returning values from while loop

    Hello forum,
    I am currently doing a bodyfat calculator for a course in school.

    I'm having a problem getting an output returned from my while loop, which determines the user's gender by user...
  15. Replies
    5
    Views
    1,005

    Oh, damn! Of course, a will gradually increase...

    Oh, damn! Of course, a will gradually increase much higher than i, thus running the code to infinity, if that was possible.
    Fixed it now and the program works (with b = 1 in the beginning of my...
  16. Replies
    5
    Views
    1,005

    My apologies if I've missed the edit option for...

    My apologies if I've missed the edit option for my previous post to prevent double posting.
    What I've come up with is the following:

    if (a > 0) {
    for(i=1;i<=a;i++)
    a=a*i;
    ...
  17. Replies
    5
    Views
    1,005

    I think I found a mistake. Shouldn't the loop end...

    I think I found a mistake. Shouldn't the loop end with i++; so i+1 is used every time the loop is run, until i < a, although that didn't solve the problem, so I'll just try to figure out what the...
  18. Replies
    5
    Views
    1,005

    Problem with a for loop

    Hello,
    I have been working on a program to calculate the factorial of numbers.
    Part of my code is copied and modified from the FAQ about validating numbers in user input.


    I have encountered a...
  19. Implemented the changes both of you suggested and...

    Implemented the changes both of you suggested and my tiny program now works. Yay! Onwards I go into the void that is C-programming ;)
    Thank you guys! Appreciate the quick replies
  20. Thank you, Salem! That was very helpful. Is...

    Thank you, Salem! That was very helpful.

    Is there any alternative to printf that I might use to be able to get the result I am looking for? Perhaps cout or something?


    Never mind the...
  21. A few days into C-programmering experience: if and else

    Hello users!
    As stated in the title, I am very new to C and programming languages in general.

    I am currently reading various guides and such, but I've come across a syntax problem when using if...
Results 1 to 21 of 21