网友您好, 请在下方输入框内输入要搜索的题目:

题目内容 (请给出正确答案)
有以下程序include using namespace std;static int days[]= { 31,28,31,30,31,30,31

有以下程序 #include <iostream> using namespace std; static int days[]= { 31,28,31,30,31,30,31,31,30,31,30,31 }; class date { private: int month, day, year; public: date( int m, int d, int y ) { month = m; day = d; year = y; } date() {} void disp() { cout<<year<<"-"<<month<<"-"<<day<<end1; } date operator+( int day ) { date dt = *this; day+= dt.day; while ( day > days[dt.month - 1 ] ) { day -= days[ dt.month - 1 ]; if ( ++dt.month == 13 ) { dt.month = 1; dt.year++; } } dt.day = day; return dt; }; int main() { date d1( 6, 20, 2004 ), d2; d2: d1 + 20; d2.disp(); return 0; } 执行后的输出结果是

A.2004-7-10

B.2004-6-20

C.2004-7-20

D.程序编译时出错


参考答案

更多 “ 有以下程序include using namespace std;static int days[]= { 31,28,31,30,31,30,31 有以下程序 #include <iostream> using namespace std; static int days[]= { 31,28,31,30,31,30,31,31,30,31,30,31 }; class date { private: int month, day, year; public: date( int m, int d, int y ) { month = m; day = d; year = y; } date() {} void disp() { cout<<year<<"-"<<month<<"-"<<day<<end1; } date operator+( int day ) { date dt = *this; day+= dt.day; while ( day > days[dt.month - 1 ] ) { day -= days[ dt.month - 1 ]; if ( ++dt.month == 13 ) { dt.month = 1; dt.year++; } } dt.day = day; return dt; }; int main() { date d1( 6, 20, 2004 ), d2; d2: d1 + 20; d2.disp(); return 0; } 执行后的输出结果是A.2004-7-10B.2004-6-20C.2004-7-20D.程序编译时出错 ” 相关考题
考题 有以下程序 include int i=0; void fun( ) { { static int i=1 有以下程序 #include<iostream> int i=0; void fun( ) { { static int i=1; Std::cout<<i++<<','; } Std::cout<<i<<','; } int main( ) { fun();fun(); return O; } 程序执行后的输出结果是A.1,2,1,2,B.1,2,2,3,C.2,0,3,0,D.1,0,2,0,

考题 有以下程序: include using namespace std; constxntN=5; int fun(char*s,char a,int 有以下程序:include <iostream>using namespace std;const xnt N=5;int fun(char *s,char a,int n){int j;*s=a;j=n;while(a<s[j])j--;return j;}int main(){char s[N+1];int k;

考题 有以下程序: include using namespace std; int f(int); int main() {int i;for(i=0; 有以下程序:include <iostream>using namespace std;int f(int);int main(){int i;for(i=0;i<5;i++)cout<<f(i)<<" ";return 0;}int f(int i){static int k=1;for(;i>0;i--)k+=i;

考题 以下程序的输出结果是【】。includevoid main() {int *p;p=new int;*p=200;cout 以下程序的输出结果是【 】。include<iostream. h>void main() {int *p;p=new int;*p=200;cout<<*p;delete p;}

考题 有以下程序includeint i=0;void fun(){{ Static int i=1 Std::cont 有以下程序 #include<iostream,h> int i=0; void fun() { { Static int i=1 Std::cont<<i++<<','; } Std::cout<<i<<','; } int main() { fun();fun(); return 0; } 程序执行后的输出结果是( )。A.1,2,1,2,B.1,2,2,3,C.2,0,3,0,D.1,0,2,0,

考题 有以下程序: include int i=0;void fun(){{static iht i=1; std::cout 有以下程序: # include <iostream> int i=0; void fun() {{static iht i=1; std::cout<<i++<<','; } std:: cout<<i<<','; } int main() { fun(); fun(); return 0; }程序执行后的输出结果是______。A.1,2,1,2,B.1,2,2,3,C.2,0,3,0,D.1,0,2,0,

考题 有以下程序:include using namespace std; class Base { public: Base() { K=0; } int 有以下程序:include<iostream>using namespace std;class Base{public:Base(){K=0;}int x;};class Derivedl:virtual public Base{public:Derivedl(){x=10;}};class Derived2:virtua1 public Base

考题 如下程序的输出结果是includevoid fun(int x=y;y=t;}int main(){in 如下程序的输出结果是 #include<iostream> void fun(int & X,inty){intt=x;x=y;y=t;} int main( ){ int a[2]={23,42}; fun(a[1],a[0]); std::cout<<a[0]<<","<<a[1]<<std::endl; return 0; }A.42,42B.23,23C.23,42D.42,23

考题 有以下程序:include using namespace std;define PI 3.14class Point{ private:int 有以下程序: #include <iostream> using namespace std; #define PI 3.14 class Point { private: int x,y; public: Point(int a,int b) { x=a; y=b; } int getx() { return x; }A.314B.157C.78.5D.153.86

考题 有以下程序include int i = 0;void fun( ){ {static int i = 1;std::cout 有以下程序 #include <iostream> int i = 0; void fun( ) { { static int i = 1; std::cout<<i++<<','; } std::cout<<i<<','; } int main() { fun(); fun(); return 0; } 程序执行后的输出结果是A.1,2,1,2,B.1,2,2,3,C.2,0,3,0,D.1,0,2,0,