導航:首頁 > 專利知識 > vc編寫使用期限

vc編寫使用期限

發布時間:2021-09-02 17:24:18

⑴ 用Vc++編寫程序,根據輸入的年月,輸出該月的天數,到底那裡錯了怎樣改

變數使用前用先賦初值。
你的邏輯表達式有問題。
如果是大月,有賦值。如果是平月,有賦值。如果是小月,也有賦值。這是正確的。
問題出在最後兩句,那個else 是永遠也執行不到的。所以最後一句的d是得不到賦值的。

根據最近匹配原則,你的邏輯是,m既不是大月也不是小月也不是平月,才列印。。。(怎麼可能有這樣的月呢)

所以去掉最後一個else就好了。

⑵ 在vc6.0使用時間暫留不行

sleep(100)表示停留100毫秒,只有0.1秒鍾,你感覺不出來的。

⑶ VC++6.0,怎樣用語句來修改系統時間.

vc++6.0中可以使用setLocalTime函數來修改系統時間。
使用API函數SetLocalTime進行本地時間設置的方法:
1)SetLocalTime函數的原型:
BOOL SetLocalTime( const SYSTEMTIME *lpSystemTime );
輸入參數lpSystemTime是一個SYSTEMTIME類型的參數,如果設置成功,返回true,本地時間將會變成lpSystemTime所指定的時間,否則返回false。
看一下SYSTEMTIME的格式:
typedef struct _SYSTEMTIME {
WORD wYear;
WORD wMonth;
WORD wDayOfWeek;
WORD wDay;
WORD wHour;
WORD wMinute;
WORD wSecond;
WORD wMilliseconds;
} SYSTEMTIME, *PSYSTEMTIME;
2)利用SYSTEMTIME結構體和SetLocalTime函數進行本地時間的設置舉例:
SYSTEMTIME st;結構體聲明
st.wYear = 2007;賦值年份
st.wMonth = 11;賦值月份
st.wDay = 24;賦值天
st.wHour = 3;賦值小時
st.wMinute = 14;賦值分鍾
st.wSecond = 0;賦值秒
st.wMilliseconds = 0;賦值毫秒
SetSystemTime(&st);把結構體變數出入SetSystemTime函數即可。
以上對結構體成員的賦值,除wDayOfWeek成員之外,其它各成員都進行賦值了,甚至連wMilliseconds。使用這種方式進行系統時間設置時,會忽略wDayOfWeek成員,可以不進行該成員的賦值(即使你賦值了也不會被考慮的),但其它所有成員都必須時行賦值,否則無法成功地進行時間設置。

⑷ PE/VC 創投的期限是「8+1+1」年是啥意思啊 如果是8+1+1的話,營業執照上寫幾年啊

投資期限適合不同的基金相關的。 而一個創投可能可以管理好幾支基金。 每隻內基金都會有個容年限, 通常我看到的是8+2, 意思是基金投資到回報基本是8年, 但如果多數投資人同意的情況下,可以延期兩年結算。 也有是3+5的說法,三年投資,五年回收投資

⑸ VC設置系統日期,是日期

看看有沒有相關的API可以用

IContactProperties::SetDate Method
Sets the date and time value at a specified property to a given FILETIME. All times are stored and returned as coordinated universal time (UTC).

Syntax

HRESULT SetDate( LPCWSTR pszPropertyName,
DWORD dwFlags,
FILETIME ftDateTime
);
Parameters

pszPropertyName
[in] Specifies the property to set.
dwFlags
[in] CGD_DEFAULT can be used to create or overwrite value at pszPropertyName.
ftDateTime
[in] FILETIME structure to use for date.
Return Value

Returns one of the following values:

S_OK Value is set at this property.
ERROR_PATH_NOT_FOUND Property name invalid for set.
ERROR_INVALID_DATATYPE Unable to set the value for this property e to schema.

setTime Method

Sets the date and time value in the Date object.

dateObj.setTime(milliseconds)
Arguments
dateObj
Required. Any Date object.
milliseconds
Required. A numeric value representing the number of elapsed milliseconds since midnight, January 1, 1970 GMT.
Remarks
If milliseconds is negative, it indicates a date before 1970. The range of available dates is approximately 285,616 years from either side of 1970.

Setting the date and time with the setTime method is independent of the time zone.

Example
The following example illustrates the use of the setTime method.

function SetTimeTest(newtime){
var d, s; //Declare variables.
d = new Date(); //Create Date object.
d.setTime(newtime); //Set time.
s = "Current setting is ";
s += d.toUTCString();
return(s); //Return new setting.
}
Requirements
Version 1

See Also
Date Object Methods | getTime Method

Applies To: Date Object

--------------------------------------------------------------------------------

Send feedback on this topic to Microsoft.

© Microsoft Corporation. All rights reserved.

⑹ VC++ 用類表示某一個日期

VC++ 用類表示某一個日期
#include<iostream.h>
class ctime
{
private:
int year; //年
int month; //月
int day; //日
public:
ctime(int y=2000,int m=1,int d=1): //構造函數1
year(y),month(m),day(y)
{}
ctime(ctime&c) //構造函數2
{
month=c.month;
day=c.day;
year=c.year;
}
~ctime(void)
{}
void printctime(void)const //輸出
{
cout<<year<<"年"<<month<<"月"<<day<<"日"<<endl;
}
};
void main(void)
{
ctime today(2009,9,17);//使用構造函數1的對象定義
ctime someday;//使用默認值得對象定義
ctime someday2(today);//使用構造函數2的對象定義
someday.printctime();//列印默認日期
someday2.printctime();//列印當前日期
}

⑺ 用vc++編寫一個日期類,並實現日期類型數據的初始化和輸出

注釋。
1. for i in `ls *.mp3`
2. cp $file $target
3. [ $foo = "bar" ]
4. cd `dirname "$f"`
5. [ "$foo" = bar && "$bar" = foo ]
6. [[ $foo > 7 ]]
7. grep foo bar | while read line; do ((count++) ); done
8. if [grep foo myfile]
9. if [bar="$foo"]
10. if [ [ a = b ] && [ c = d ] ]
11. cat file | sed s/foo/bar/ > file
12. echo $foo
13. $foo=bar
14. foo = bar
15. echo <<EOF
16. su -c 'some command'
17. cd /foo; bar
18. [ bar == "$foo" ]
19. for i in {1..10}; do ./something &; done
20. cmd1 && cmd2 || cmd3
21. UTF-8的BOM(Byte-Order Marks)問題
22. echo "Hello World!"
23. for arg in $*
24. function foo()

⑻ 用C++編程一個日期

你先看看這個功能的datatype類,符不符合你要求。

下面我貼出這個類的源碼:

#include<iostream>

#include<string>

#include<iomanip>

#include<cmath>

usingnamespacestd;

classDateType{

inty,m,d;

public:

DateType(intyi=1,intmi=1,intdi=1);

voidreset_date();//重設日期

voidadd_oneday();//增加一天

intre_weekday();//返回0-6,以1年1月1日為星期一

intre_days(intmonth);//返回指定月的天數

doubled_day_111();//與1年1月1日相差的天數

doubled_day(DateTypedate);//與Date相差的天數

voidprint_table();//列印當月月歷

voidprint_table_this(intmonth);//列印指定月歷

boolthe_same(DateTypedate);//與Date是否是同一日期

voidprint_date();//列印當前日期

voidprint_animal();//列印當前日期的生肖年

voidprint_star();//列印當前日期星座

voidprint_week();//列印當前日期的星期

};

DateType::DateType(intyi,intmi,intdi){

y=yi;

m=mi;

d=di;

}

voidDateType::reset_date(){

intrun,dx;

cout<<"年:";

cin>>y;

while(y<1){

cout<<"請重新輸入年份! ";

cout<<"年:";

cin>>y;

}

cout<<"月:";

cin>>m;

while(m<1||m>12){

cout<<"請重新輸入月份! ";

cout<<"月:";

cin>>m;

}

cout<<"日:";

cin>>d;

if(m==2){

if(y%4==0&&y%100!=0||y%400==0)

run=29;

elserun=28;

while(d<1||d>run){

cout<<"請重新輸入日期! ";

cout<<"日:";

cin>>d;

}

}

else{

if(m%2==1&&m<8||m%2==0&&m>7)

dx=31;

elsedx=30;

while(d<1||d>dx){

cout<<"請重新輸入日期! ";

cout<<"日:";

cin>>d;

}

}

}

intDateType::re_weekday(){

intdy,dm,dd,py,Feb,dday=0,week,sum=0;

if(y==1){

if(m==1)

dday=d-1;

else{

for(intmon=1;mon<m;mon++)

dday=dday+re_days(mon)+d-1;

}

}

else{

dy=y-1;

dm=m-1;

dd=d-1;

for(inti=1;i<y;i++){

if(i%4==0&&i%100!=0||i%400==0){

py=366;

Feb=29;

}

else{

py=365;

Feb=28;

}

sum=(sum+py)%7;

}

if(m==2){

dday=sum+Feb+dd;

}

else{

if(dm>0&&dm<8){

dday=sum+((dm-1)/2+1)*31+(dm/2-1)*30+dd+Feb;

}

elseif(dm>7&&dm<12){

dday=sum+((dm-6)/2)*31+((dm-7)/2)*30+dd+Feb+184;

}

elseif(dm==0)

dday=sum+dd;

}

}

week=dday%7;//week=0,1,2,3,4,5,6星期一到星期日

returnweek;

}

intDateType::re_days(intmonth){

intday;

if(month==2){//二月

if(y%4==0&&y%100!=0||y%400==0)//閏年

day=29;

else//平常年

day=28;

}

else{//平常月

if((month%2==1&&month<8)||(month%2==0&&month>=8))//大月

day=31;

else//小月

day=30;

}

returnday;

}

voidDateType::add_oneday(){

intday=re_days(m);

if(d+1>day){

if(m+1>12){

y++;

m=1;

d=1;

}

else{

m++;

d=1;

}

}

elsed++;

}

boolDateType::the_same(DateTypedate){

if(y==date.y){

if(m==date.m){

if(d==date.d){

returntrue;

}

}

}

returnfalse;

}

voidDateType::print_date(){

cout<<"【"<<y<<"】年【"<<m<<"】月【"<<d<<"】日";

print_week();

cout<<"";

print_animal();

}

voidDateType::print_week(){

stringweeks[7]={"一","二","三","四","五","六","日"};

cout<<"【星期"<<weeks[re_weekday()]<<"】";

}

voidDateType::print_animal(){

stringanimal[12]={"鼠","牛","虎","兔","龍","蛇","馬","羊","猴","雞","狗","豬"};

intd_year=(y%12+8)%12;

cout<<"【"<<animal[d_year]<<"年】";

}

voidDateType::print_star(){

stringstar[12]={"魔羯座","水瓶座","雙魚座","牧羊座","金牛座","雙子座","巨蟹座","獅子座","處女座","天秤座","天蠍座","射手座"};

}

doubleDateType::d_day_111(){

doubledday,sum=0.0;

intdy,dm,dd,Feb,py;

dy=y-1;

dm=m-1;

dd=d-1;

for(inti=2;i<=y;i++){

if(i%4==0&&i%100!=0||i%400==0){

py=366;

Feb=29;

}

else{

py=365;

Feb=28;

}

sum=sum+py;

}

if(m==2){

dday=sum+Feb+dd;

}

else{

if(dm>0&&dm<8){

dday=sum+((dm-1)/2+1)*31+(dm/2-1)*30+dd+Feb;

}

elseif(dm>7&&dm<12){

dday=sum+((dm-6)/2)*31+((dm-7)/2)*30+dd+Feb+184;

}

elseif(dm==0)

dday=sum+dd;

}

returndday;

}

doubleDateType::d_day(DateTypedate){

doubled1,d2,sum=0.0;

d1=d_day_111();

d2=date.d_day_111();

sum=fabs(d1-d2);

returnsum;

}

voidDateType::print_table(){

stringweeks[7]={"一","二","三","四","五","六","日"};

intweek1,monthday;

if(m==2){

if(y%4==0&&y%100!=0||y%400==0)

monthday=29;

else

monthday=28;

}

else{

if((m%2==1&&m<8)||(m%2==0&&m>=8))

monthday=31;

else

monthday=30;

}

DateTypeymd1(y,m,1);//當月一號

week1=ymd1.re_weekday();

intday=1,k=0;

for(inti=0;i<7;i++){

cout<<setw(5)<<weeks[i];

}

cout<<endl;

while(1){

if(k!=week1&&day==1){

k++;

cout<<setw(5)<<"";

}

else{

cout<<setw(5)<<day;

day++;

k++;

}

if((k)%7==0)

cout<<endl;

if(day>monthday)

break;

}

cout<<endl;

}

voidDateType::print_table_this(intmonth){

stringweeks[7]={"一","二","三","四","五","六","日"};

intweek1,monthday;

if(month==2){

if(y%4==0&&y%100!=0||y%400==0)

monthday=29;

else

monthday=28;

}

else{

if((month%2==1&&month<8)||(month%2==0&&month>=8))

monthday=31;

else

monthday=30;

}

DateTypeymd1(y,month,1);//當月一號

week1=ymd1.re_weekday();

intday=1,k=0;

for(inti=0;i<7;i++){

cout<<setw(5)<<weeks[i];

}

cout<<endl;

while(1){

if(k!=week1&&day==1){

k++;

cout<<setw(5)<<"";

}

else{

cout<<setw(5)<<day;

day++;

k++;

}

if((k)%7==0)

cout<<endl;

if(day>monthday)

break;

}

}

下面是主函數,是用來調試效果的:

#include<iostream>

#include"DateType.h"

usingnamespacestd;

DateTypedate1;

intchiose,month_input;

voidprint_table_ohter(){//查看指定月月歷

while(1){

cout<<" 請輸入要查看的月份:";

cin>>month_input;

if(month_input<1||month_input>12)

cout<<"月份錯誤,請重新輸入! ";

else{

date1.print_table_this(month_input);

cout<<endl;

break;

}

}

}

voidget_d_days(){//計算兩日期相差的天數

DateTypedate2;

DateTypedate3;

while(1){

cout<<"請輸入日期一:";

date2.reset_date();

cout<<endl;

cout<<"請輸入日期二:";

date3.reset_date();

cout<<endl;

date2.print_date();

cout<<"與";

date3.print_date();

cout<<"相差";

cout<<date2.d_day(date3)<<"天 ";

break;

}

}

voidmain(){

while(1){

cout<<setiosflags(ios::left);

cout<<setw(20)<<"1.跳至指定日期";

cout<<setw(15)<<"2.查看日期";

cout<<setw(25)<<"3.查看當月月歷";

cout<<setw(20)<<"4.查看指定月月歷";

cout<<setw(20)<<"5.增加一天";

cout<<setw(40)<<"6.計算兩日期相差的天數";

cout<<setw(20)<<"7.待定";

cin>>chiose;

switch(chiose){

case1:date1.reset_date();break;

case2:date1.print_date();cout<<endl;break;

case3:date1.print_table();break;

case4:print_table_ohter();break;

case5:date1.add_oneday();date1.print_date();break;

case6:get_d_days();cout<<endl;break;

case7:break;

default:cout<<"您沒有選擇任何操作! ";break;

}

cout<<endl;

}

}

這是我做課程設計一時,做的題目,有點多,慢慢看,希望可以幫到你啦~

⑼ C語言編寫 輸入 年 月 日 ,輸出這個日期的下一天的日期

利用C標准函數time,localtime,mktime來實現
先將輸入的年月日放到tm結構中
用mktime()函數生成一個整數
用這個整數+86400(24*60*60)
然後再轉換成日期就OK了

⑽ vc編程中日期加天數怎麼算

使用CTimeSpan這個類,可以直接累加小時、天數 然後得到目標日期,很方便。

閱讀全文

與vc編寫使用期限相關的資料

熱點內容
湖北省醫療糾紛預防與處理辦法 瀏覽:230
星光創造營後勤在哪 瀏覽:581
北京辦理知識產權 瀏覽:177
交通銀行信用卡有效期是幾年 瀏覽:913
公司協議股權轉讓 瀏覽:531
啥叫擔保物權 瀏覽:60
馬鞍山到徐州的火車 瀏覽:703
羊年限定金克絲多少錢 瀏覽:573
公共基本衛生服務結核項目試題 瀏覽:896
寶雞市工商局電話號碼 瀏覽:81
基本公共衛生服務督導工作方案 瀏覽:454
信息化成果總結 瀏覽:948
債務糾紛律師費必須提供發票嗎 瀏覽:876
手機我的世界創造模式怎麼去天堂 瀏覽:716
專利代理人個人總結 瀏覽:312
工商局黨建工作述職報告 瀏覽:685
創造力閱讀理解答案 瀏覽:866
金華質監局和工商局合並 瀏覽:334
衛生院公共衛生服務考核結果 瀏覽:693
專利權的內容有哪幾項 瀏覽:750