Search:

Type: Posts; User: Charlie Lesoine

Search: Search took 0.01 seconds.

  1. This did not work...

    This did not work...
  2. I just did a google search for "equality...

    I just did a google search for "equality comparison with float" And found a page that provided a solution to this issue. instead of using an equality comparison something like this instead:

    if...
  3. Well the array that I am using to count the...

    Well the array that I am using to count the frequency (mode_counter) is an integer array. The other numbers are floats because I have to calculate other things with them, but I am not sure why that...
  4. I am just trying to find the standard...

    I am just trying to find the standard mathematical mode. The number or numbers which appear most frequently

    For example:

    1,1,1,2,2,3,9,4,6

    The mode is 1

    or
    1,1,1,2,2,2,3,8,6,5,0
  5. Problem, counting the number of occurrences of each number in an array

    As part of finding the mode of an array of float numbers, the first step is to count the number of occurrences of each number in the array. I am trying to do this starting on line 166, but something...
  6. Yeah I didn't put in the operator prompt fully...

    Yeah I didn't put in the operator prompt fully yet, I was just trying to figure out the code first.

    Also, using EOF is part of the assignment for my class. It is from the book C by Discovery which...
  7. Now the program is hanging after returning to the...

    Now the program is hanging after returning to the main while loop. It is not getting stuck in an infinite loop, but it still does not respond to the scanf. For example, user first selects option 1...
  8. Thanks Tater! I used the second option you...

    Thanks Tater! I used the second option you provided. Worked like a charm!
  9. Ok well first I tried just with the spaces before...

    Ok well first I tried just with the spaces before the %d and %f on line 27 and line 37:



    #include <stdio.h>
    #include <stdlib.h>
  10. Well I tried putting in an extra getchar() and...

    Well I tried putting in an extra getchar() and putting a space in front of the %d and the %f. Neither of those seemed to work...
  11. Nope!

    Nope!
  12. I understand that. The while loop is basically...

    I understand that. The while loop is basically the whole program and Case 3 is for when the user wants to exit the program. The problem I'm having is that when user selects 1 (case 1) and then exits...
  13. While loop not stopping for scanf for some reason. please help!

    Ok I have a while loop here which contains a switch statement (I have only fleshed out case 1) and functions normally , except for when in case 1 I hit CTRL-D (for EOF, could be CTRL-Z for you). This...
  14. Well I'm not using it now. Any suggestions on how...

    Well I'm not using it now. Any suggestions on how to get the while loop to work the way I want it to?
  15. I tried putting a fflush(stdin) at the end of the...

    I tried putting a fflush(stdin) at the end of the while loop and at a few other places. That did not work. In order for this program to function the way I wanted it to I had to add this outside...
  16. Yes...my instructor is very strange....

    Yes...my instructor is very strange....
  17. So does that mean the second character is being...

    So does that mean the second character is being evaluated? Or what?
  18. Part of the assignment was to have it end that...

    Part of the assignment was to have it end that way.
  19. Why is this while loop repeating the last iteration of arithmetic when exiting

    I am not exactly sure what is going on here. The code seems to function the way I expect it to except that when I exit the while loop it repeats the math of the last run through of the loop. Sorry if...
  20. Replies
    5
    Views
    3,075

    Sorry I still don't know what to do... ...

    Sorry I still don't know what to do...

    doublevar is a double not a char:



    scanf(" %c %lf", &charvar, &doublevar);
  21. Replies
    5
    Views
    3,075

    I read the page you linked, but I am still not...

    I read the page you linked, but I am still not sure how to alter my code. I am a beginner...
  22. Replies
    5
    Views
    3,075

    How to continue if no user input

    If I have a scanf like this:



    scanf(" %c %lf", &charvar, &doublevar);


    How do I get the program to continue if the user only inputs the one char and no double character? For example if...
  23. Thanks Andrew! Putting a space between opening...

    Thanks Andrew! Putting a space between opening quotes and the %c did the trick! That was really annoying. I thought C ignored white space characters...I guess this rule does not apply 100% of the...
  24. Simple calculator program not letting me use the same operator (+.-.*./) twice

    I am trying to make a simply calculator that allows the user to continually modify a result using +,-,*, or / , however for some reason my code is only letting me use each operator (+,-,*, or /) one...
Results 1 to 24 of 24