Thread: work calculator question

  1. #1
    Registered User
    Join Date
    Sep 2020
    Posts
    9

    Post work calculator question

    hi!

    i have to write a program which asks the user "how many days" (he worked), then asks "how many hours in day 1" then "how many in day 2 etc..
    heres the thing what i cant figure out, since it involves arrays.
    when i enter 5 days, the program has to understand that he will ask me only until "how many days in day 5:" and then calculates the rest, which im probably capable of coding, but i cant wrap my head around that connection with that one. also since i study every day, all day and cant take a day off not to study programming, i have alot to finish still ,until end of year and my brain goes wooheehoo :S

    im thankful for any help or links, which adress that thingy.
    (couldnt find any array examples of that one at all)

  2. #2
    Registered User
    Join Date
    Sep 2020
    Posts
    150
    I would suggest to use a List. https://www.dotnetperls.com/list
    First you need to read the number of days.
    Then you use a for loop and read the number of hours for that day and add them to the list. Then you print the list and whatever else you want to do with it.

  3. #3
    Registered User
    Join Date
    Sep 2020
    Posts
    9
    hey thmm, thanks for the reply, but i posted in the wrong section, since i need help with C. i will look into your link, if i get more clues to use it in C somehow with some modification. thats the link to the other thread: work calculator and arrays

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. simple printing calculator in C doesn't work
    By Pierre Hardy in forum C Programming
    Replies: 6
    Last Post: 02-10-2012, 02:03 PM
  2. how does typedef work in this question ???
    By mohnish_khiani in forum C Programming
    Replies: 1
    Last Post: 07-23-2011, 08:55 AM
  3. Home work question
    By ArtistMan35 in forum C Programming
    Replies: 9
    Last Post: 11-02-2010, 07:27 AM
  4. pushback question (reverse polish calculator)
    By Tool in forum C Programming
    Replies: 8
    Last Post: 12-29-2009, 02:29 PM
  5. A question about my calculator program.
    By hector_ronado in forum C++ Programming
    Replies: 1
    Last Post: 11-01-2009, 12:05 PM

Tags for this Thread