Instead of asking me for the aperture value , the fprintf gets seemingly skipped , and the next thing that prints is that parture = 0.0f , when it hasnt even prompted me for an input :
#include...
Type: Posts; User: ki113r
Instead of asking me for the aperture value , the fprintf gets seemingly skipped , and the next thing that prints is that parture = 0.0f , when it hasnt even prompted me for an input :
#include...
The size of this thread is mostly due the fact that some of the comments don't really help me much , very much like your post . If you actually read through you would see that the f in front stands...
/Edit That aperture==f4.0 is in fact in line with the rest of the values in my code .
I changed some thins now .However I get quite a few errors .
{
^
test5(27) : Error: '(' expected...
Ok before I hand this in , can someone just please go over my indenting , because I haven't done it before . I assume there isno strict rules , just making the code easier to read. Did I indent the...
oh how embarrassing .... / goes to hide under a rock
Does that book say something like this :
printf("The aperture value entered is : %.1ff");
But I get :
The aperture value entered is : 0.0f .
Any idea on what I'm doing wrong ?
Heh , a bit too late for that now , the assignement is due tomorrow :o
How would I limit the printf ouput to only 1 decimal when it prints out the float? I tried searching the FAQ to no avail
Simple and effective I like it :) I am pretty sure there won't be more questions, the rest seems quite starightforward :)
If I can store it as a float it's even better . How would I do that ?
Maybe there's a way to simply ignore the input of the first character , and store the rest in a string ?
Turns out the user must enter the f value , and the program must process the whole thing . I think the way I will handle this is to use string compare. I think my tutor would prefer that to fgets....
Ok , well ill get some sleep now, and ask my tutor about using fgets , thanks a lot for your help :)
...................
I was just trying it with gotos , in case its the while loop thats causing the problem . :) , but it seems to be fine
Wohoo , it sort of worked
C:\Users\Ben\dm\bin>test3
Enter Exposure Time: 12
The selected Exposure time is 12
Please enter the aperture size 1.4
Invalid aperture=1610612736
Please Try...
I have to use scanf , its one of the requirements from my lecturer
Unfortunately it still does the infinite loop Btw this is how it looks when I run it :
http://img119.imageshack.us/img119/3227/coders4.jpg
Yeh no problem Pete . Thats what it gave me , lemme try it again ...
wow it worked now . This is crazy :-|
If you want you are more than free to write my assignement lol
Lexican Error
..................
It won't compile for me , it gives me an error.
But if ((aperture==1.2f. . . ) doesn't work
#include <stdio.h>
int main(void)
{
int exposure=0;
float aperture=0;
int choice = 0;
printf("\nEnter Exposure Time: ");
scanf("%d",&exposure);