Search:

Type: Posts; User: k4k45hi

Page 1 of 2 1 2

Search: Search took 0.00 seconds.

  1. Replies
    10
    Views
    1,890

    at the moment i have to enter my name 3 times...

    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...
  2. Replies
    10
    Views
    1,890

    this is what ive done. do { ...

    this is what ive done.




    do
    {
    fprintf(output,"please enter your name:\n");fflush(stdout);
    fgets(name, 20, input);
  3. Replies
    10
    Views
    1,890

    well the name can be at most 20 values. so i...

    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.
  4. Replies
    10
    Views
    1,890

    ok 2 problems. first how do you stop fgets...

    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...
  5. Replies
    10
    Views
    1,890

    help with string length loop.

    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...
  6. Replies
    84
    Views
    8,594

    just realised we will now be using fgets. so...

    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.
  7. Replies
    84
    Views
    8,594

    hey ive included this in my code ...

    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...
  8. Replies
    84
    Views
    8,594

    ok. fiddled around a bit. ive made it so that...

    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.
  9. Replies
    84
    Views
    8,594

    input output exposure 1.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 ...
  10. Replies
    84
    Views
    8,594

    http://pastebin.com/d2d9d78f4

    http://pastebin.com/d2d9d78f4
  11. Replies
    84
    Views
    8,594

    ive even tried 1.2f. that freezes to. f1f...

    ive even tried 1.2f.

    that freezes to.

    f1f but will print the error message.
  12. Replies
    84
    Views
    8,594

    i want to know why res doesnt kick in when it...

    i want to know why res doesnt kick in when it should.
  13. Replies
    84
    Views
    8,594

    yes they want the f. which makes it so much...

    yes they want the f. which makes it so much harder. ive got it so close.

    this sucks.
  14. Replies
    84
    Views
    8,594

    we dont use fgets. i dont know if im allowed to...

    we dont use fgets.
    i dont know if im allowed to use it. only what ive been tought.

    would fflush do anything?
  15. Replies
    84
    Views
    8,594

    yeh ive tried it. its even in my code atm....

    yeh ive tried it.

    its even in my code atm.
    but for some reason even if i dont enter two values it wont work.
  16. Replies
    84
    Views
    8,594

    im so close now. just quiet get it.

    im so close now.

    just quiet get it.
  17. Replies
    84
    Views
    8,594

    it now semi works. it compiles. and when i type...

    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...
  18. Replies
    84
    Views
    8,594

    well i tried this for...

    well i tried this



    for (j=0;j<(sizeof(validaperture) / sizeof(validaperture[0]));j++)
    {
    if ((validfocus == focus)&&(aperture == validaperture[j]))
    {
    fprintf(output,"the...
  19. Replies
    84
    Views
    8,594

    nevermind. i did it anyway. still wont print...

    nevermind.
    i did it anyway.

    still wont print anything out.

    gahhh. getting annoyed now.
  20. Replies
    84
    Views
    8,594

    and remove the for focus for loop?

    and remove the for focus for loop?
  21. Replies
    84
    Views
    8,594

    int i; int j; float exposuretime; float...

    int i;
    int j;
    float exposuretime;
    float aperture;
    char focus;
    int res;
    char validfocus[] = {"f"};
    float validaperture[] =...
  22. Replies
    84
    Views
    8,594

    this is whats happening after i change it to ==....

    this is whats happening after i change it to ==.
    before it was printing random large numbers.
  23. Replies
    84
    Views
    8,594

    oh yeh. my bad. how come nothing prints, it...

    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...
  24. Replies
    84
    Views
    8,594

    like this (although this doesnt work, just prints...

    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) /...
  25. Replies
    84
    Views
    8,594

    ok im confused. for now i just want the program...

    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...
Results 1 to 25 of 46
Page 1 of 2 1 2