C++ error expression cannot be used as function

前端 未结 2 1662
野性不改
野性不改 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 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.

提交回复
热议问题