学习Vc++大概要多长时间才能开发程序
答案:2 悬赏:80 手机版
解决时间 2021-02-21 01:53
- 提问者网友:欲劫无渡
- 2021-02-20 15:56
学习Vc++大概要多长时间才能开发程序
最佳答案
- 五星知识达人网友:独行浪子会拥风
- 2021-02-20 16:35
学几分钟就可以了…………做一个…………hello world只是看你想做哪类程序而已,每种程序都需要不同的时间 ………………如果你之前学过别的语言的话,应该也不会说很久的。如果没学过别的语言就学VC++的话那就要超级长的时间了……建议先学C再学C++
全部回答
- 1楼网友:一秋
- 2021-02-20 16:42
没做完,再等等
#include
using namespace std;
class time
{
private:
short int hour;
short int minute;
short int sec;
short int year;
short int month;
short int day;
bool am , pm , _12_24 , ad ;
public:
time()
{
setyear();
setmonth();
setday();
sethour();
setminute();
setsec();
cout << "\n\n" ;
_12_24 = true;
}
void setyear()
{
a:
cout << "请输入年:";
cin >> year;
if (year == 0 )
{
cout << "年份不得为0,请重新输入!" ;
goto a;
}
else if (year > 0 )
{
ad = true;
}
else if (year < 0 )
{
ad = false ;
}
}
void setmonth()
{
a:
cout << "请输入月:";
cin >> month;
if (month > 12)
{
cout << "输入错误,请重新输入!" << endl;
goto a;
}
}
void setday()
{
int i ;
if (year % 4 == 0 )
{
i = 29;
}
else
{
i = 28 ;
}
const int c[] = {31,i,31,30,31,30,31,31,30,31 ,30,31};
for (i = 0 ;i < (month-1) ;i++)
{
;
}
a:
cout << "请输入日:";
cin >> day;
if (day > c[i])
{
cout << "输入错误,请重新输入!" << endl;
goto a;
}
}
void sethour()
{
a:
cout << "请输入时:";
cin >> hour;
if (hour > 24)
{
cout << "输入错误,请重新输入!" << endl;
goto a;
}
}
void setminute()
{
a:
cout << "请输入分:";
cin >> minute;
if (minute > 60)
{
cout << "输入错误,请重新输入!" << endl;
goto a;
}
}
void setsec()
{
a:
cout << "请输入秒:";
cin >> sec;
if (sec > 60)
{
cout << "输入错误,请重新输入!" << endl;
goto a;
}
}
void display()
{
cout << endl ;
if (year < 0 )
ad = false;
else
ad = true;
if (ad == true)
{
cout << "公元" << year;
}
else if (ad == false)
{
double temp;
temp = (double)year;
temp = abs(temp);
year = (int)temp;
cout << "公元前" << year;
}
cout <<"年" << month << "月" << day << "日" << endl;
if (_12_24 != true)
{
if (am == true)
{
cout << "上午" ;
}
else if (pm == true)
{
cout << "下午" ;
}
}
cout << hour << "时" << minute << "分" << sec << "秒" << endl;
}
void conversion()
{
int flag;
cout <> flag;
switch(flag)
{
case 1:
{
if (_12_24 != true )
{
_12_24 = true;
am = pm = false;
hour += 12;
}
else
{
break;
}
}
case 2:
{
if (_12_24 != false)
{
_12_24 = false;
if (hour >= 12 )
{
pm = true;
am = false;
hour -= 12;
break ;
}
if (hour < 12)
{
pm = false;
am = true;
break ;
}
}
else
{
break;
}
}
}
}
bool compare(time a)
{
if (year > a.viewyear() )
{
return true;
}
else
{
if (month > a.viewmonth() )
{
return true;
}
else
{
if (day > a.viewday() )
{
return true;
}
else
{
if (hour > a.viewhour() )
{
return true;
}
else
{
if (minute > a.viewminute())
{
return true;
}
else
{
if (sec > a.viewsec())
{
return true;
}
else
{
return false;
}
}
}
}
}
}
}
void operator + (int a )
{
int flag , i;
if (year % 4 == 0 )
{
i = 29;
}
else
{
i = 28 ;
}
const int c[] = {31,i,31,30,31,30,31,31,30,31 ,30,31};
for (i = 0 ;i < (month-1);i++)
{
;
}
cout << "\t\t\t1.给年加" << endl << "\t\t\t2.给月加" << endl
<< "\t\t\t3.给日加" << endl << "\t\t\t4.给时加" << endl
<< "\t\t\t5.给分加" << endl <<"\t\t\t6.给秒加" <> flag;
switch(flag)
{
case 1:
{
year += a ;
if (ad == false && year >= 0 )
{
ad = true ;
year += 1;
}
break;
}
case 2:
{
month += a;
if (month >= 12 )
{
year += 1 ;
if (ad == false && year >= 0 )
{
year += 1;
ad == true;
}
month = 0 ;
}
break;
}
case 3:
{
int temp;
day += a;
if (day >= c[i])
{
month += 1 ;
day -= c[i];
if (month > 12 )
{
year += 1 ;
if (ad == false && year >= 0 )
{
year += 1;
ad == true;
}
month = 1 ;
}
}
break;
}
case 4:
{
int temp;
hour += a ;
if (hour >= 24)
{
day += 1;
hour = 0;
if (day >= c[i])
{
month += 1 ;
day -= c[i];
if (month > 12 )
{
year += 1 ;
if (ad == false && year >= 0 )
{
year += 1;
ad == true;
}
month = 1 ;
}
}
}
break;
}
case 5:
{
int temp;
minute += a ;
if (minute >= 60)
{
hour += 1 ;
if (hour >= 24)
{
day += 1;
hour = 0;
if (day >= c[i])
{
month += 1 ;
day -= c[i];
if (month > 12 )
{
year += 1 ;
if (ad == false && year >= 0 )
{
year += 1;
ad == true;
}
month = 1 ;
}
}
}
}
break;
}
case 6:
{
int temp;
sec += a;
if (sec >= 60 )
{
minute += 1 ;
sec = 0 ;
if (minute >= 60)
{
hour += 1 ;
if (hour >= 24)
{
day += 1;
hour = 0;
if (day >= c[i])
{
month += 1 ;
day -= c[i];
if (month > 12 )
{
year += 1 ;
if (ad == false && year >= 0 )
{
year += 1;
ad == true;
}
month = 1 ;
}
}
}
}
}
}
break;
}
}
void operator - (int a )
{
int flag;
cout << "\t\t\t1.给年减" << endl << "\t\t\t2.给月减" << endl
<< "\t\t\t3.给日减" << endl << "\t\t\t4.给时减" << endl
<< "\t\t\t5.给分减" << endl << "\t\t\t6.给秒减" <> flag;
switch(flag)
{
case 1:
{
year -= a;
if (year <= 0 && ad == true)
{
year -= 1;
ad = false ;
}
break;
}
case 2:
{
if (a < month)
month -= a;
else
{
year -= 1 ;
if (year <= 0 && ad == true)
{
year -= 1;
ad = false ;
}
if (a < 12 )
month = 12 - (a - month ) ;
else
cout <<"您输入的数大于或者等于12,请直接用年来减";
}
break;
}
case 3:
{
int i ;
if (year % 4 == 0 )
{
i = 29;
}
else
{
i = 28 ;
}
const int c[] = {31,i,31,30,31,30,31,31,30,31 ,30,31};
for (i = 0 ;i < (month-1) ;i++)
{
;
}
if (day >= c[i])
{
cout << "您输入的数大于或者等于了这一月的天数,请直接用月减";
break;
}
if (a < day)
day -= a;
else
{
month -= 1;
if (month == 0 )
{
month = 12 ;
year -= 1 ;
if (year <= 0 && ad == true )
{
year -= 1;
}
}
day = c[i] - (a - day) - 1 ;
}
break;
}
case 4:
{
if (a <= hour)
hour -= a ;
else
{
}
break;
}
case 5:
{
if (a <= minute)
minute -= a ;
else
{
}
break;
}
case 6:
{
if (a <= sec)
sec -= a;
else
{
}
break;
}
}
}
};
我要举报
如以上问答信息为低俗、色情、不良、暴力、侵权、涉及违法等信息,可以点下面链接进行举报!
大家都在看
推荐资讯