求解求解求解??!
用這種代碼的好處在哪里?
用這種代碼的好處在哪里?
2017-09-27
#include<stdio.h>
int main()
{
?int year=2008;
?int month=8;
?int day=8;
?int a;
?int b;
?int c;
?int d;
?a=year%4;
?b=1
?
?if(month>2)
?{
???? if(month-5.5==0.5||3.5||4.5)
????? {for(b;b<=12-month;b++)
?? {if(b%2!=0)
???? {result=result+31;
???? }
???? else
???? {result=result+30;
???? }
????? }
????? c=366-result+day;
????? printf("現(xiàn)在已經(jīng)過了%d天了",c);
????? }
?????
??
???? else if(month==9)
????? {for(b;b<=12-month;b++)
?? {if(b%2!=0)
???? {result=result+31;
???? }
???? else
???? {result=result+30;
???? }
??? c=366-result+day;
????? }
????? printf("現(xiàn)在已經(jīng)過了%d天了",c);
????? }?
???? else if(month=11)
????? {for(b;b<=12-month;b++)
?? {if(b%2!=0)
???? {result=result+31;
???? }
???? else
???? {result=result+30;
???? }
??? c=366-result+day;
????? }
????? printf("現(xiàn)在已經(jīng)過了%d天了",c);
????? }
???? else if(month=4)
????? {result=(12-month+2)/2*31+(12-month-2)/2*30;
?????? c=366-result+day;
?????? printf("現(xiàn)在已經(jīng)過了%d天了",c);
????? }
???? else if(month=6)
????? {result=(12-month+2)/2*31+(12-month-2)/2*30;
?????? c=366-result+day;
?????? printf("現(xiàn)在已經(jīng)過了%d天了",c);
????? }
??????? else i
????? {if(month=1)
??????? {result=31;
????? printf("現(xiàn)在已經(jīng)過了%d天了",result);
??}
???? else
???? {result=31+29;
????? printf"現(xiàn)在已經(jīng)過了%d天了",result);
??}
?? }
??? }??
??
還有一個(gè)問題要請(qǐng)教大家,這個(gè)是我自己在DEV C++上寫的,但是編譯時(shí)一直顯示else if(month==9)錯(cuò)誤,如果就單單從語句的使用來看,請(qǐng)大家?guī)兔Ω嬖V我是哪里錯(cuò)了,謝謝
忘記傳了,抱歉
代碼呢?
舉報(bào)
2017-09-28
沒缺什么