The question requests for a FOR loop to be used using a constant. Namely (const int NR_JOBS = 6).
obviously that variable cannot change because its a constant. How should the For loop be:
eg: for (int cnt=1; NR_JOBS > 6; cnt++);
HOW does this loop terminate because we cannot increment NR_JOBS as its a contant!
the loop has to execute 6 times using the constant NR_JOBS.
I cannot even assign cnt to NR_JOBS because NR_jobs is a constant!
You're quite right that NR_JOBS cannot change which makes me wonder why your comparison is "NB_JOBS > 6". If you rewrite what you have in more pseudocode you'll get
1. make NB_JOBS constant with a value of 6
2. make cnt an integer with an initial value of 1
3. if NB_JOBS > 6 continue with 4. If not, jump forward to 7.
4. /// whatever the contents of your FOR loop would be
5. increment cnt
6. jump back to 3.
7. // the rest of your program
The comparison "6 > 6" will always be false so your FOR loop will never execute. If you want your loop to run for up to NB_JOBS times, you need to compare something to NB_JOBS, not the other way round. Hint: You already have a variable that you're incrementing.
the above will work, but if I mix variables the compiler will complain.
float DailyWorkout(float hours, int days)
how would i call a function with mixed variables from the main().
and how do I initialize them. Should I initialise the variable as a float then convert it to an integer after returning from the function?