at the moment i have to enter my name 3 times before it inputs the name. and it doesnt loop.
what is wrong.
please help im having a really hard time
do
{
fprintf(output,"please...
Type: Posts; User: k4k45hi
at the moment i have to enter my name 3 times before it inputs the name. and it doesnt loop.
what is wrong.
please help im having a really hard time
do
{
fprintf(output,"please...
this is what ive done.
do
{
fprintf(output,"please enter your name:\n");fflush(stdout);
fgets(name, 20, input);
well the name can be at most 20 values.
so i need to check to see if the string entered is less then 20 values. i dont think your check does this.
ok 2 problems.
first how do you stop fgets from including \n within the name.
and how do you create a loop to repeat until fgets has the right amount of values.
and if to many values are...
i need some help. i need my code to ask the user for his or her name and check with it is shorter then 20 characters. here is what ive done
do
{
fprintf(output,"please enter your...
just realised we will now be using fgets.
so ive got a class on this 2moro,
i will see how i go with it. and who knows.
might be able to fix this.
hey
ive included this in my code
fprintf(output,"please enter aperture value:");fflush(output);
resapp = fscanf(input,"%c%f",&focus,&aperture);
fprintf(output,"resapp is...
ok. fiddled around a bit.
ive made it so that res prints out the fscanf.
now.
when i type f1.2
it reads 1.
1.2
it reads 2.
input output
exposure 1.2 1.2
aperture f1.2 f1.2
exposure f1.2 res error
aperture f1.2
exposure f1.2 0.0
aperture ...
http://pastebin.com/d2d9d78f4
ive even tried 1.2f.
that freezes to.
f1f but will print the error message.
i want to know why res doesnt kick in when it should.
yes they want the f. which makes it so much harder. ive got it so close.
this sucks.
we dont use fgets.
i dont know if im allowed to use it. only what ive been tought.
would fflush do anything?
yeh ive tried it.
its even in my code atm.
but for some reason even if i dont enter two values it wont work.
im so close now.
just quiet get it.
it now semi works.
it compiles.
and when i type any of the correct values it will print the correct value.
and if the number is not correct it will print and error
buut if it does not recieve the...
well i tried this
for (j=0;j<(sizeof(validaperture) / sizeof(validaperture[0]));j++)
{
if ((validfocus == focus)&&(aperture == validaperture[j]))
{
fprintf(output,"the...
nevermind.
i did it anyway.
still wont print anything out.
gahhh. getting annoyed now.
and remove the for focus for loop?
int i;
int j;
float exposuretime;
float aperture;
char focus;
int res;
char validfocus[] = {"f"};
float validaperture[] =...
this is whats happening after i change it to ==.
before it was printing random large numbers.
oh yeh. my bad.
how come nothing prints,
it still prints the exposure which the printf statement is located before the for loops.
but for the aperture, it doesnt print anything out, not even...
like this (although this doesnt work, just prints out random large number)
for (i=0;i<(sizeof(validfocus) / sizeof(validfocus[0]));i++)
{
for (j=0;j<(sizeof(validaperture) /...
ok im confused.
for now i just want the program to check to see what is valid
and if they are valid print the value if not print error.
i know later i can return 1 when i need to go back to the...