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

题目内容 (请给出正确答案)
有以下程序include usingnamespacestd;static int days []={31,28.31,30,31,30,31,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 -= tays[ dt.month - 1 ]; if ( ++dt.month == 13 { dt.month = 1; dt.yeare++; } } dr. 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 usingnamespacestd;static int days []={31,28.31,30,31,30,31,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 -= tays[ dt.month - 1 ]; if ( ++dt.month == 13 { dt.month = 1; dt.yeare++; } } dr. 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 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;

考题 有以下程序:includeusing namespace std;int f(int,int);int main(){ int i:1,x; x=f 有以下程序: #include<iostream> using namespace std; int f(int,int); int main() { int i:1,x; x=f(i,i+1); cout<<x<<end1; return 0; } int f(int a,int b) { int c; c = a; if(a>b) c = 1; else if(a==b) c = 0; else c = -2; return c; } 运行后的输出结果是( )。A.1B.0C.-1D.-2

考题 有以下程序: 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;

考题 有以下程序: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

考题 以下程序的执行结果是 ( )。include using namespace std;class sample{private: int 以下程序的执行结果是 ( )。 #include <iostream> using namespace std; class sample { private: int x; public: sample (int A) { x=a; } friend double square(sample s); }; double square(sample s) {A.20B.30C.900D.400

考题 有以下程序:include include using namespace std;class base{private: cha 有以下程序: #include <iostream> #include <string> using namespace std; class base { private: char baseName[10]; public: base ( ) { strcpy (baseName, "Base"); } virtual char *myName() {A.DerivedBaseB.BaseBaseC.DerivedDerivedD.BaseDerived

考题 有以下程序: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 using namespace std;class A{private: int a;public: A(int 若有以下程序: #include <iost ream> using namespace std; class A { private: int a; public: A(int i) { a=i; } void disp () { cout<<a<<", "; } }; class B { private:A.10,10,10B.10,12,14C.8,10,12D.8,12,10

考题 以下程序执行后的输出结果是include.using namespace std;void try(int,int,int,int) 以下程序执行后的输出结果是 #include<iostream>. using namespace std; void try(int,int,int,int); int main() { int x,y,z,r; x=1; y=2; try(x,y,z,r); cout<<r<<end1; return 0; } void try(int x,int y, int z,int r) { z = x+y; x = x*x; y = y*y; r = z+x+y; }A.18B.9C.10D.不确定

考题 阅读以下程序,给出运行结果 #include <iostream> #include <cstring> using namespace std; int main() { string str="I love China!"; cout << str; return 0; }