내가 산 날 계산하는건데
입력을 해도
70만일 살았다고 나오는데..
어디가 어떻게 잘못된건지 모르겠음..
알려줘요 ㅠㅠ 고수님들
#include <stdio.h>
int main(void)
{
int year=0;
int month=0;
int date=0;
int year2=0;
int month2=0;
int date2=0;
int g=year+1;
int sum = 0, sum2, sum3 , total;
printf("생년월일을 입력하시오. \n년 : ");
scanf_s("%d", &year);
printf("월 : ");scanf_s("%d", & month);
printf("일 : "); scanf_s("%d", &date);
printf("오늘날짜를 입력하시오.\n년 : ");
scanf_s("%d", & year2);
printf("월 : "); scanf_s("%d", &month2);
printf("일 : "); scanf_s("%d", &date2);
for(g; g<=year2-1; g++)
{
if(g%4==0&&g0!=0||g@0==0)
sum=sum+366;
else
sum=sum+365;
}
if(year2%4==0&&year20!=0||year2@0==0)
{
if(month2=1)
sum2=date2;
if(month2=2)
sum2=31+date2;
if(month2=3)
sum2=60+date2;
if(month2=4)
sum2=91+date2;
if(month2=5)
sum2=121+date2;
if(month2=6)
sum2=152+date2;
if(month2=7)
sum2=182+date2;
if(month2=8)
sum2=213+date2;
if(month2=9)
sum2=243+date2;
if(month2=10)
sum2=273+date2;
if(month2=11)
sum2=304+date2;
if(month2=12)
sum2=334+date2;
}
else
{
if(month2=1)
sum2=date2;
if(month2=2)
sum2=31+date2;
if(month2=3)
sum2=59+date2;
if(month2=4)
sum2=90+date2;
if(month2=5)
sum2=120+date2;
if(month2=6)
sum2=151+date2;
if(month2=7)
sum2=181+date2;
if(month2=8)
sum2=212+date2;
if(month2=9)
sum2=242+date2;
if(month2=10)
sum2=272+date2;
if(month2=11)
sum2=303+date2;
if(month2=12)
sum2=333+date2;
}
if(month=12)
sum3=31-date+1;
if(month=11)
sum3=61-date+1;
if(month=10)
sum3=92-date+1;
if(month=9)
sum3=122-date+1;
if(month=8)
sum3=153-date+1;
if(month=7)
sum3=184-date+1;
if(month=6)
sum3=214-date+1;
if(month=5)
sum3=245-date+1;
if(month=4)
sum3=275-date+1;
if(month=3)
sum3=306-date+1;
{if(year%4==0&&year0!=0||year@0==0)
{
if(month=2)
sum3=335-date+1;
if(month=1)
sum3=366-date+1;
}
else
{
if(month=2)
sum3=334-date+1;
if(month=1)
sum3=365-date+1;
}}
total = sum + sum3 + sum2 ;
printf("태어난 날을 포함하여 오늘까지 살아온 날 : %d\n", total);
return 0;
}
year2@0 @이거 뭐냐? IF문에서 왜 죄다 대입임?
그거 오류난건데 수정다했어요.. 그런 문법적인거 말고 뭐라고 해야하나 방식이 틀렸다고 해야하나..ㅠㅠ
저거 돌려서 scanf자리에 알맞는 숫자 쳐서 넣으면 .. 정작 값이 내가 산 날 값이 70만 뭐라고나옴..
http://zappygo.com/w_c/9777
고마워요.. ㅠㅠ 결국 저건 왜틀린지 모르는건가 ㅋ
시발 구조체 클래스로하면 금방코드몇줄안되는데 극혐
너의 코드는 if문으로 떡칠되어 있어서 파악하기도 귀찮아서 그래
근성가이
와 뭐여 이거