C++ error expression cannot be used as function

前端 未结 2 1661
野性不改
野性不改 2021-01-29 16:43

How can I edit my formula for

weekday=(day+2(month)+3(month)/5+year+year/4-year/100+year/400)/7

so that I dont get an error message saying \"e

相关标签:
2条回答
  • 2021-01-29 16:58

    The code 2(month) is function call syntax, as if 2 were a function... but it's not. Do you perhaps mean multiplication, such as 2 * month?

    0 讨论(0)
  • 2021-01-29 17:03

    You need to enter an operator (*) for multiplication:

    weekday=(day+2*(month)+3*(month)/5+year+year/4-year/100+year/400)/7;
    

    If the operator is missing c(++) interprets it as a function call, wherebthe function name is e.g. 2.

    0 讨论(0)
提交回复
热议问题