第七色在线视频,2021少妇久久久久久久久久,亚洲欧洲精品成人久久av18,亚洲国产精品特色大片观看完整版,孙宇晨将参加特朗普的晚宴

為了賬號(hào)安全,請及時(shí)綁定郵箱和手機(jī)立即綁定
已解決430363個(gè)問題,去搜搜看,總會(huì)有你想問的

請問變量day怎么賦初值啊?

請問變量day怎么賦初值?。?/h1>
C
瀟湘沐 2023-04-02 21:17:33
#include<stdio.h>void main(){unsigned int year,leap;<br>printf("enter year:");<br>scanf("%d",&year);<br>if(year%400==0)<br>leap=1;<br>else<br>{if (year%4==0&&year%100!=0)<br>leap=1;<br>else leap=0;<br>}if(leap==1)printf("%d:is a leap year.",year);else printf("%d is not a leap year.",year);unsigned int month,day;printf("enter month:");scanf("%d",&month);printf("%d\n",day);} 1 warning(s) warning C4700: local variable 'month' used without having been initialized 
查看完整描述

2 回答

?
ibeautiful

TA貢獻(xiàn)1993條經(jīng)驗(yàn) 獲得超6個(gè)贊

.#include <stdio.h>
int leapYear(int year) // 判斷是否為潤年
{
if ((year % 4 == 0 && year % 100 != 0) || year % 400 == 0)
return 1;
else
return 0;
}

void main()
{
int year, month;
int m[12] = {31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31};
printf ("請輸入日期(格式:年 月):");
scanf ("%d%d", &year, &month);
if (leapYear(year)) m[1] += 1;
printf ("%d年%d月共有%d天\n", year, month, m[month - 1]);
}

查看完整回答
反對 回復(fù) 2023-04-05
?
慕森卡

TA貢獻(xiàn)1806條經(jīng)驗(yàn) 獲得超8個(gè)贊

#include<iostream>
using namespace std;
int isLeap(int year)
{
if( year%400 == 0 || (year %4 == 0 && year %100 !=0))
{
return 1;
}
else
{
return 0;
}
}
int main()
{
int year;
int month;
int a[12]={31,28,31,30,31,30,31,31,30,31,30,31};
cout<<"please input the year"<<endl;
cin>>year;
cout<<"please input the month"<<endl;
cin>>month;
if(isLeap(year))
{
a[1] = a[1] +1;
}
cout<<"days = "<<a[month-1]<<endl;
cin.get();
cin.get();
return 0;
}

查看完整回答
反對 回復(fù) 2023-04-05
  • 2 回答
  • 0 關(guān)注
  • 178 瀏覽

添加回答

舉報(bào)

0/150
提交
取消
微信客服

購課補(bǔ)貼
聯(lián)系客服咨詢優(yōu)惠詳情

幫助反饋 APP下載

慕課網(wǎng)APP
您的移動(dòng)學(xué)習(xí)伙伴

公眾號(hào)

掃描二維碼
關(guān)注慕課網(wǎng)微信公眾號(hào)