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...
Type: Posts; User: TobiasK
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...
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...
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...
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...
Here's my code:
FileSave(); /* Returns the variable BFpercent, lets say 25.000 */
printf("BFpercent is: %lf", BFpercent); /* Successfully prints BFpercent is: 25.000 */
...
Oooh yeah, bugger!
Forgot that tiny & in the scan. All the small things! It seems to work now, after implementing vart's code.
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); /*...
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...
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...
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,...
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...
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...
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...
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...
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...
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;
...
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...
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...
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
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...
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...