• 2022-06-16
    写出程序运行结果:#include"stdio.h"#include"string.h"main(){charst1[15],st3[15],st2[]="CLanguage";strcpy(st1,st2);strcpy(st3,st2,3);puts(st1);puts(st3);printf("");}
  • CLanguageCL

    内容

    • 0

      中国大学MOOC: 下面程序输出结果为:#include<iostream>using namespace std;#include<string.h>int main( ){ char st[20]="hello\0\t\\"; cout<<strlen(st); cout<<sizeof(st)<<endl; cout<<st; return 0;}

    • 1

      完成下面类中成员函数的定义。#include &#91;iostream&#93; #include &#91;string&#93; using namespace std; class str {private: char *st; public: str(char *a) {set(a); } str & operator=(str &a) {delete st; set(a.st); return *this; } void show(){cout<<st<<endl;} ~str(){delete st;} void set(char *s)//初始化st {_____ strcpy(st,s); } }; void main() {str s1("he"),s2("she"); s1.show(),s2.show(); s2=s1; s1.show(),s2.show();}

    • 2

      手工和动力工具除锈:以“St”表示,可分为St2、St3两个等级。

    • 3

      将字符串“Hello!”赋值给字符数组st,不正确的是:() A: char st[5]="Hello!" B: char st[]={'H','e','l','l','0','!'} C: char st[10]="Hello!" D: char st[10];strcpy(st,"Hello!");

    • 4

      #include int main() {char st='A'; int i=10; st=st+i;i=st%i; printf("%c,%d\n",st,i); return 0; } 已知字母A的ASCII码为65 结果:____