[单选题]

有如下程序: include using namespace std; int main() { char st

有如下程序: #include <iostream> using namespace std; int main() { char str[100], *p; cout<<"Please input a string:"; cin>>str; p=str; for (int i=0; *p!='/0'; p++,i++); cout<<i<<endl; return 0; }运行这个程序时,若输入字符串为 abcdefgabcd则输出结果是

A.7

B.12

C.13

D.100

参考答案与解析:

相关试题

有如下程序:#include using namespace std;using

[单选题]有如下程序:include using namespace std;using namespace std;class Base{public:vo有如下程序: #include <iostream> using namespace std; using namespace std; class Base{ public: void fun( ){cout<<"Base::fun"<<endl:} }; class Derived:public Base{ public: void fun(

  • 查看答案
  • 有如下程序: include using namespace std; int

    [主观题]有如下程序: include using namespace std; int strle(char a[],char b[]) {int num=有如下程序:include <iostream>using namespace std;int strle(char a[],char b[]){int num=O,n=O;while (* (a+num) !='/0')num++;while (b [n] ){* (a+num)=b [n];num++;n++;}return(num);}i

  • 查看答案
  • 有如下程序: include using namespace std; clas

    [试题]有如下程序: include using namespace std; class Monitor{ public: Monitor(cha有如下程序:include<iostream>using namespace std;class Monitor{public:Monitor(char t):type(t){ }void Print( )const{cout<<"The type of monitor is"<<type< private:char type;};class Com

  • 查看答案
  • 有如下程序: include using namespace std; clas

    [试题]有如下程序: include using namespace std; class TestClass{ int k; public: TestCla有如下程序:include<iostream>using namespace std;class TestClass{int k;public:TestClass(int x=1):k(x){}~TestClass O{cout<<k;}};int main(){TestClass a[]={TestClass(3),TestClass(3),Tes

  • 查看答案
  • 有如下程序: include using namespace std; clas

    [试题]有如下程序: include using namespace std; class A { public: virtual void f(){cout有如下程序:include<iostream>using namespace std;class A{public:virtual void f(){cout<<"1";}};class B:public A{public:B. (){cout<<"2";}};class C:public B{public:virtual void f(){

  • 查看答案
  • 有如下程序:#include £«using namespace std ;#i

    [单选题]有如下程序:#include +using namespace std ;#includeusing namespace std;class Base{public:void fun(){cout<<"Base::fun"<};class Derived:public Base{public:void fun(){cout<<"Derived::fun"<}};int main(){D.erived d;d.fun();return 0;}已知其执行后

  • 查看答案
  • 有如下程序: #include using namespace std; cla

    [单选题]有如下程序: include using namespace std; class Complex { dou有如下程序: #include<iostream> using namespace std; class Complex { double re, im; public: Complex(double r, double i): re(r), im(i) {} double real() const { return re; } double image() const { return

  • 查看答案
  • 有如下程序: #include using namespace std; cla

    [单选题]有如下程序: include using namespace std; class Base { public:有如下程序: #include<iostream> using namespace std; class Base { public: void fun() { cout<<"Base::fun"<<endl; } }; class Derived: public Base { public: void tim() } ____________ cout<<"Derived::

  • 查看答案
  • 有如下程序: #include using namespace std; int

    [单选题]有如下程序: include using namespace std; int main() { int *p;有如下程序: #include<iostream> using namespace std; int main() { int *p; *p=9; cout<<"The value at p:"<<*p; return 0; } 编译运行程序将出现的情况是A.编译时出现语法错误,不能生成可执行文件B.运行时一定输出:The value at p:9C.运行时一定输出:The val

  • 查看答案
  • 有如下程序: #include using namespace std; cla

    [单选题]有如下程序: include using namespace std; class A { public: A(){cout<<"A";} ~A()有如下程序: #include<iostream> using namespace std; class A { public: A(){cout<<"A";} ~A(){cout<<"~A";) }; class B:public A { A*p; public: B(){cout<<"B";p=new A;} ~B(){cout<

  • 查看答案
  • 有如下程序: #include  using namespace std; in