首页/ 题库 / [单选题]下面程序的输出结果是( )。#inclu的答案

下面程序的输出结果是( )。#include <iostream>using namespace std;void main(){int s;for(int k=2;k<6;k+=2)s=1;for(int j=k; j<6;j++) s+=j;cout<<s<<end1;

单选题
2021-12-31 22:45
A、9
B、1
C、11
D、10
查看答案

正确答案
D

试题解析

标签:
感兴趣题目
若有如下程序: #include <iostream> using namespaces std; int s=0; class sample { static iht n; public: sample(int i) { n=i; } static void add() { s+=n; } }; int sample::s=0; int main() { sample a(2),b(5); sample::add(); cout<<s<<endl; return 0; } 程序运行后的输出结果是
若有以下程序: #include 〈iostream〉 using namespace std; class sample { private: int n; public: sample(){} sample(int m) { n=m; } void addvalue(int m) { sample s; s.n=n+m; *this=s; } void disp() { cout〈〈"n="〈〈n〈〈end1; } }; int main() { sample s(10); s.addvalue(5); s.disp(); return 0; } 程序运行后的输出结果是( )。
下面程序的运行结果为( )。 #include <iostream> using namespace std; class A{ public: A(){cout<<" ";} ~A(){cout<<" ";} } class B:public A{ public: B(){cout<<" ";} ~B(){cout<<" ";} } void main(){ B b; }
下面程序的输出结果是( )。 #include <iostream> using namespace std; class A { public: A( ) {cout<<"A";} } class B { public: B() {coat<<"B" ;} } class C: public A { public: B b; C() {cout<<"C";} } void mian(){ C c; }
设程序如下: #include<iostream> using namespace std; int main() { int **p,*q,r=10; q=&r; p=&q; cout<<**p+1<<end1; return 0; } 以上程序的输出结果是( )
有如下程序: #include<iostream> using namespace std; class VAC{ public; intf()const{return 3;} int f(){return 5;} }; Int main(){ VAC v1; const VAC v2; cout<<v1.f()<<v2.f(); return 0; } 运行时的输出结果是( )。
下面程序的输出结果是( )。 #include <iostream> using namespace std; void main( ) { int i=8,*p=0; p = &i; coat<<p; }
有下列的程序: #include<cstring.h> #include<iostream.h> using namespace std; class MyString { public: MyString(const char*s); ~MyString()<delete[]data;} protected: unsigned len; char*data; };
下面程序输出的结果是( )。 #include<iostream> using namespace std; void main() { char ch[][8]={"good","better","best"}; for(int i=1;i<3;++i) { cout<<ch[i]<<endl; } }
有以下程序: #include <iostream> #include <string> using namespace std; int main () { char s[]=" 123\"; cout<<strlen (s) <<", "<<sizeof (s) <<end1; return 0; }
有以下程序: #include <iostream> using namespace std; int main() { int x=15; while(x>10&&x<50) { x++; if(x/3) { x++; break; } } cout<<x<<end1; return 0; } 执行后的输出结果是
有以下程序: #include<iostream> using namespace std; int main() { int x=15; while(x>10&&x<50) { x++; if(x/3) { x++;break; } } cout<<x<<endl; return 0; } 执行后的输出结果是( )。
相关题目
下面程序的运行结果为( )。 #include <iostream> using namespace std; class A{ public: A(){cout<<" ";} ~A(){cout<<" ";} } class B:public A{ public: B(){cout<<" ";} ~B(){cout<<" ";} } void main(){ B b; }
下面程序的输出结果是( )。 #include<iostream> using namespace std; void main() { int a=18; int * p=&a; cout<<* p;}
假定有如下程序: #include <iostream> using namespace std; int s =0; class example{ static int n; public: example(int i){ n=i; } static void add( ){ s+=n; } }; int example::n=0; int main( ){ example a(2),b(5); example::add(); cout<<s<<endl; return 0; }程序运行后输出结果为( )。
下面程序的输出结果是( )。#include <iostream>using namespace std;void main(){int s;for(int k=2;k<6;k+=2)s=1;for(int j=k; j<6;j++) s+=j;cout<<s<<end1;
如下程序的输出结果是 #include<iostream> using namespace std: int main( ){ int sum: for(inti=O;i<6;i+=3){ sunl=i: for(intj=i;j<6;j++)suitL+=j; } cout<<sum<<endl: retuIn 0:
有如下程序: #include<iostream> using namespace std; class DA{ int k; public: DA(int x=1):k(x){} ~DA(){cout<<k;} }; int main(){ DAd[]={DA(3),DA(3),DA(3)}; DA*p=new DA[2]; delete[]p; return(); } 这个程序的输出结果是( )。
有如下程序: #include<iostream> using namespace std; class Base{ public: Base(int x=0){cout<<x;} }; class Derived:public Base{ public: Derived(int x=0){cout<<x;} private: Base val; }; int main( ){ Derived d(1); return 0; } 程序的输出结果是
有如下程序: #include <iostream> using namespace std; class Base { public: Base(int x=0) { cout<<x; } } class Derived: public Base{ public: Derived(int x=0) { cout<<x; } private: Base val; }; int main() { Derived d(1); return 0; }程序的输出结果是
下列程序的输出结果为( )。 #include (iostream) using namespace std; void main( ) char,a[ ] = { "hello" ," the" ," world" }; char * * pa = a: pa + +; cout << * pa << ENDL; }
以下程序的输出结果是( )。 #include<iostream> using namespace std; void fun(char**q) { ++q; cout<<*q<<end1; } main() { static char*s[]={"HI","HELL0","TEST"}; char**p; p=s; fun(p); system("PAUSE"); return 0; }
关于语句#include<iostream>using namespace std;void main(){cout<<100.8989663<<';com<<fixed<<100.8989663<<';cout<<scientific<<100.8989663<<';}的输出结果为( )
以下程序的执行结果是 ( )。 #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) {
若有如下程序: #include<iostream> using namespace std; int s=O; class sample { static int n; public: sample(int i) { n=i; } static void add() { s+=n; } }; int sample::s=0; int main() { sample a(2),b(5); sample::add(); cout<<S<<end1; return 0; } 程序运行后的输出结果是
若有如下程序: #include <iostream> using namespaces std; int s=O; class sample { static int n; public: sample(int i) { n=i; } static void add() { s+=n; } }; int sample::s=O; int main() { sample a(2),b(5); sample: :add(); cout<<s<<end1; return 0; } 程序运行后的输出结果是
若有以下程序: #include<iostream> using namespace std; class sample { private: int n; public: sample(){} sample(int m) { n=m; } void addvalue(int m) { sample s; s.n=n+m; *this=s; } void disp() { cout<<"n"=<<n<<end1; } }; int main() { sample s(10); s.addvalue(5); s.disp(); return 0; } 程序运行后的输出结果是
若有如下程序:#include <iostream>using namespaces std;int s=0;class sample{static int n;public:sample(int i){ n=i;}static void add(){ s+=n;}};int sample:: n=0;int main(){sample a(2),b(5);sample:: add();cout<<s<<end1;return 0;}程序运行后的输出结果是( )。
若有如下程序: #include <iostream> using namespaces std; int s=0; class sample, { static int n; public: sample(int i) { n=i; } static void add() { s+=n; } }; int sample::s=0; int main() { sample a(2),b(5); sample::add(); cout<<s<<end1; return 0; } 程序运行后的输出结果是( )。
有以下程序: #include <iostream> using namespace std; class sample { private: int n; public: sample(){} sample(int m) { n=m; } void addvalue(int m) { sample s; s.n=n+m; *this=s; } void disp () { cout<<"n="<<n<<endl; } }; int main() { sample s (10); s.addvalue(5); s.disp(); return 0; } 程序运行后的输出结果是
若有如下程序: #include<iostream> using namespace std; int s=0; class sample { static int n; public: sample(int i) { n=i; } static void add() { S+=n; } }; int sample::n=0; int main() { sample a(2),b(5); sample::add(); cout<<s<<endl; return 0; } 程序运行后的输出结果是( )。
有如下程序: #include<iostream> using namespace std; int s=0; class sample { static int n; public: sample(int i) { n=i; } static void add() { s+=n; } }; int sample::s=0; int main() { sample a(2),b(5); sample::add(); cout<<s<<endl; return 0; } 程序运行后的输出结果是
广告位招租WX:84302438

免费的网站请分享给朋友吧