Home > Back-end >  Novice C language for help
Novice C language for help

Time:06-10

//each data said the daily minimum temperature, and then print statistical total day
//the number and the minimum temperature below zero days accounted for the percentage of the total number of days,
#include
#include
360//# define qw1 cut-off rate of 1
468//# define qw2 cut-off rate of 2
720//# define qw3 cut-off rate of 3
0.1323////# define f1 was first used 360 KWH rate
# define f2/0.1504/then use 108 KWH rate
# define f3/0.30025/then use 252 KWH rate
# define the f4 0.3425//the use of more than 720 KWH rate
//use the cost of 360
* 360 # define qfei (f1)
//use the cost of 468
# define qfei1 (qfei + f2 * (qw2 - qw1))
//use the cost of 720
# define qfei2 (qfei + qfei1 + f3 * (qw3 - qw2)
Int main (void)
{
Double qianwan;
Double fy;
Printf (" please enter how many kw use ");
Lf the scanf (" % ", & amp; Qianwan);
If (qianwan<=qw1)
{
Fy=qianwan * f1;//the cost of less than or equal to 360 kw
}
Else if (qianwan>=qw1 & amp; & Qianwan<=qw2)
{
Fy=qfei + f2 (qianwan - qw1) *;//the cost of less than or equal to 420 kw
}
Else if (qianwan>=qw2 & amp; & Qianwan<=qw3)
{
Fy=qfei1 + f3 (qianwan - qw2) *;//cost of less than or equal to 720
}
The else
{
Fy=qfei2 + ((qianwan - qw3) * f4);//cost of more than 720
}
Printf (" always use % % is the total cost of lf. The 2 f ", qianwan, fy);//total cost
return 0;
}


[color=# 800000] machine error A.C PP (38) : error C2143: syntax error: missing ') 'before'; '
Why fy=qfei2 + ((qianwan - qw3) * f4);//to want to add this line more than 720 charges)
Correct code fy=qfei2 + (f4 (qianwan - qw3) *)) with brackets to run!
I feel so much more added a bracket is not? There are bosses know?
[/color]

CodePudding user response:

Because your definition of preprocessing in a less)

CodePudding user response:

CodePudding user response:

reference 1st floor weixin_42593366 response:
because your definition of preprocessing in a less)

Correct answer

CodePudding user response:

reference 1st floor weixin_42593366 response:
because your definition of preprocessing in a less)

That line # define qfei2 less a parenthesis

CodePudding user response:

Suggestions are put, put parentheses around the brackets to write your code in parentheses, so it is not easy to leak the brackets,

CodePudding user response:

//using the cost of 720 
# define qfei2 (qfei + qfei1 + f3 * (qw3 - qw2))

Less a right parenthesis ~

CodePudding user response:

reference proorck2019 reply: 3/f
Quote: refer to 1st floor weixin_42593366 response:
because your definition of preprocessing in a less)

Correct answer
I also just learned a few days

CodePudding user response:


I hope it can help you: https://blog.csdn.net/it_xiangqiang/category_10581430.html
I hope it can help you: https://blog.csdn.net/it_xiangqiang/category_10768339.html
  • Related