Search:

Type: Posts; User: Futomara

Page 1 of 2 1 2

Search: Search took 0.01 seconds.

  1. Replies
    26
    Views
    3,114

    @KCfromNC - Now that's pretty darned elegant. I...

    @KCfromNC - Now that's pretty darned elegant. I haven't seen that way before.
  2. Replies
    26
    Views
    3,114

    One thing that is unclear is why pointers...

    One thing that is unclear is why pointers shouldn't be used. I understand they are better for memory management. So, why not always use them?
  3. Replies
    26
    Views
    3,114

    @laserlight - My expectation is to learn the best...

    @laserlight - My expectation is to learn the best coding practices, whether it be instructor 'taught' or through self-teaching. I generally learn better with the latter. However, it is always nice to...
  4. Replies
    26
    Views
    3,114

    I prefer to ask it here where I can get an answer...

    I prefer to ask it here where I can get an answer I can understand. Plus, I won't always have an instructor. What then? Exactly, I'll be back here asking for help.
  5. Replies
    26
    Views
    3,114

    Tater, *t[i] = 0; The above code is...

    Tater,



    *t[i] = 0;


    The above code is not proper pointer syntax. Just to verify this, I made changes to my source, and it errors out.

    I only need to initialize each element and then I am...
  6. Replies
    26
    Views
    3,114

    Yes, I've gone through several runs and it does...

    Yes, I've gone through several runs and it does not crash and returns the proper results.

    Basically, I left everything as is except instead of declaring total as a pointer I keep it as an array....
  7. Replies
    26
    Views
    3,114

    Jim, We were not taught this in class. I tried...

    Jim,

    We were not taught this in class. I tried it and it works. What if I change it like this:



    double total[6];


    and keep the other (affected) lines of code like this:
  8. Replies
    26
    Views
    3,114

    Total is an array. Pointer syntax is to be used....

    Total is an array. Pointer syntax is to be used. If I am improperly initializing it, then show me how. Your code seems to change total from a pointer to a primitive and it compiles with a list of...
  9. Replies
    26
    Views
    3,114

    Now, I am converting the arrays to pointers....

    Now, I am converting the arrays to pointers. Hopefully I don't need to start a new thread. Please tell me if I do. When I compile, I get this error:

    warning C4700: uninitialized local variable...
  10. Replies
    26
    Views
    3,114

    Jim, Thank you!! You are helping me understand...

    Jim,

    Thank you!! You are helping me understand C programming much better. My instructor isn't that great, obviously, which is why I sought help elsewhere. I seem to be making simple mistakes. I...
  11. Replies
    26
    Views
    3,114

    Okay, so now my output is like this: ...

    Okay, so now my output is like this:




    Employee Total Pay
    ------- -----------
    Pete Rose 112233.00
    Pete Rose 332211.00...
  12. Replies
    26
    Views
    3,114

    Without the ampersand the program crashes. ...

    Without the ampersand the program crashes.

    There are no global variables allowed either. So the name array is within main().

    So, how do I get the array to enumerate properly? Notice it is only...
  13. Replies
    26
    Views
    3,114

    Array output not as expected

    I am creating simple program to take input of an employee number (1-5) and how much their paycheck was. I loop until no more entries are desired. Then, I output their name (based on their employee...
  14. Replies
    34
    Views
    8,889

    Won't that cause a problem with this function...

    Won't that cause a problem with this function when it's called here (red)?:



    /*========================menu()=================================================*/
    int menu()
    {
    int choice;
    ...
  15. Replies
    34
    Views
    8,889

    I got it!! ...

    I got it!!



    /*=======================add()==================================================*/
    void add()
    {
    int prodNum, prodType, prodQuant;
    double prodCost, prodPrice;
    char choice;
  16. Replies
    34
    Views
    8,889

    Well, you are right. It fails when I try to go...

    Well, you are right. It fails when I try to go through the loop again. Here is the current code I'm testing:



    /*=======================add()==================================================*/...
  17. Replies
    34
    Views
    8,889

    I went back through and found I didn't change a...

    I went back through and found I didn't change a couple min and max to doubleMin and doubleMax. The program now outputs properly.



    Sierra Sporting Goods

    Enter the Product Number: 1 to 9999: 1...
  18. Replies
    34
    Views
    8,889

    Thanks for taking another look at my code. In...

    Thanks for taking another look at my code.

    In testing out your solution, the program crashes because of the clearerr(fp) citing "The variable 'fp' is being used without being initialized."

    If I...
  19. Replies
    34
    Views
    8,889

    Update

    I want to re-explain the problem, as I still do not have all the solutions.

    The assignment is to modify a prior lab. Here are the relevant lines of unmodified code from the prior lab:


    ...
  20. Replies
    34
    Views
    8,889

    I don't think this will work because getint() is...

    I don't think this will work because getint() is called in the menu() function with actual values instead of variables.



    int menu()
    {
    int choice;

    title();
  21. Replies
    34
    Views
    8,889

    Correct... this is not what I want. I want it to...

    Correct... this is not what I want. I want it to cycle through each item.



    Yes, but I don't know what to change in those functions.




    Yes, each line is min, max. I showed an example of...
  22. Replies
    34
    Views
    8,889

    Yes, the input file is as follows: 1 9999...

    Yes, the input file is as follows:



    1 9999
    1 5
    1 50
    5.00 900.00
    6.00 1000.00
  23. Replies
    34
    Views
    8,889

    If I change the line to: while (fscanf(fp,...

    If I change the line to:



    while (fscanf(fp, "%lf%lf", &min, &max) != EOF)


    not only does it still not cycle through all inputs, but my output is:
  24. Replies
    34
    Views
    8,889

    I did refer to the link the first time you...

    I did refer to the link the first time you suggested it There are two data types being called for. So, was I given the wrong advice? I don't see the solution.

    The data in the text file is both...
  25. Replies
    34
    Views
    8,889

    I tried %f thinking it would pass the int's and...

    I tried %f thinking it would pass the int's and the doubles. The numbers were still wrong. If I use %d, then when the value being passed is a double, it truncates the decimal portion. In addition,...
Results 1 to 25 of 29
Page 1 of 2 1 2