1樓:匿名使用者
#include
#include
static char *;
static char *month[12]=;
static day[12]=;
int leap(int year);
int week(int year);
void main()
while (year<=1900); //要求輸入的年份必須大於1900
if(leap(year)) //閏年的二月份為29天
day[1]=29;
initweek=week(year);
cout<<"\n\t"< for (i=0;i<12;i++) cout<<"\n\t"; for (k=0;k<35;k++) //輸出一條橫線 cout<<"-"; initweek=(initweek+day[i]%7)%7; //計算下一個月1號的星期號 }cout< }//判斷year年份是否為閏年 int leap(int year) //計算year年的1月1日是星期幾 int week(int year) 採用c++編寫程式試建立一個日期類(date)。 2樓:匿名使用者 #include using namespace std; class date void setyear(int year)int getyear() void setmonth(int month)int getmonth() void setday(int day) int getday() void printtime() };int main() 採用c++編寫程式試建立一個時間類(time)。 3樓:匿名使用者 你看行不行 :#include #include using namespace std; //time.h class time ;//time.cpp //#include "time.h" time::time(int h, int m,int s)void time::sethour(int h)int time::gethour() void time::setminute(int m)int time::getminute()void time:: setsecond(int s)int time::getsecond()void time::print() {cout< c++ 設計並實現一個日期類date 4樓: #include #include using namespace std; class date main() cout<<"請輸入日:"; cin>>day; while(day>31||day<1) tdate(day,month,year); tdate(); cout<<"請輸入增加變數:"; cin>>tmp; d1+tmp; tdate(); d1++; tdate(); }date::date() void date::setdate(int d,int m, int y) void date::getdate() date& date::operator ++() 用c++程式設計定義一個滿足如下要求的date類: (1)用日月年的格式輸出日期; (2)可執行在日期上加一天操作; 5樓:匿名使用者 位元組除錯下,設定日期 public class date() public: date():m_day(0),m_mouth(0),m_minute(0){}; date(int _day,int _mouth,int _year):m_day(_day),m_mouth(_mouth),m_year(_year){}; void setdate(int _day,int _mouth,int _year) ~data(){}; ostream &operate<<(ostream &,const date& _date) privata: int m_day; int m_mouth; int m_minute;} include int main printf 1 權 2 20 ld sum return 0 main printf ld s 上面復的程式都已經制溢位了,int哪能儲存那麼大的數呀,應該用陣列來分割儲存!include int main m 2,t 3 for m 1 m 20 m c 1 t... 求出該整數的各個位 比如 125,百位為1,十位為2,個位為5 依次放入int型陣列,x 另外定義一個9個大小的int陣列a,初始化為0然後迴圈,每個迴圈裡switch x i case 1 a 0 省略 第一步 先判斷輸入的整數是多少位的,比如輸入的是 123 就是三位的 第二步 將這個數除以10... main 用baic語言編寫兩du個數求和 zhi求積求 dao商?include float add float x,float y float multiply float x,float y float divide float x,float y void main include main...編寫c程式求1 2 3 ,編寫一個c程式 求1 2 3
C 編寫小程式(思路即可),C 編寫一個小程式(思路即可)
用C語言編寫兩個數求和求積求商,編寫一個C語言程式,輸入兩個數的乘積和和,輸出這兩個數。