Ask Question

Is there a syntax error in the following code? bool hourlyWorker = true; if (hourlyWorker) cout << "The employee is an hourly worker./n"; else cout << "The employee is not an hourly worker./n";

+1
Answers (1)
  1. 1 October, 11:53
    0
    No, there is not

    Explanation:

    The code will print - > The employee is an hourly worker.

    Here is how:

    - hourlyWorker is set as true

    - Then we check this part of the code - > if (hourlyWorker)

    - If this is true, then the code will print "The employee is an hourly worker."

    - If not, then the code will print "The employee is not an hourly worker."

    Since if (hourlyWorker) is true, it will print "The employee is an hourly worker."
Know the Answer?
Not Sure About the Answer?
Find an answer to your question 👍 “Is there a syntax error in the following code? bool hourlyWorker = true; if (hourlyWorker) cout ...” in 📗 Computers & Technology if the answers seem to be not correct or there’s no answer. Try a smart search to find answers to similar questions.
Search for Other Answers