[单选题]

有下列程序:includeinclude "string.h"typedef struct{char name[9]; char sex;float

有下列程序: #include <stdio.h> #include "string.h" typedef struct{char name[9]; char sex;float score[2];}STU; void f(STU A) { STU b={"Zhao",'m',85.0,90.0}; int i; strcpy(a.name,b.name); a.sex=b.sex; for(i=0;i<2;i++) a.score[i]=b.score[i]; } main() { STU c={"Qian",'f',95.0,92.0}; f(C) ; printf("%s,%c,%2.0f,%2.0f/n",c.name,c.sex,c.score[0],c.score[1]); } 程序的运行结果是( )。

A.Qian,f,95,92

B.Qian,m,85,90

C.Zhao,f,95,92

D.Zhao,m, 85,90

参考答案与解析:

相关试题

有下列程序:#include#include "string.h"typedef

[单选题]有下列程序:includeinclude "string.h"typedef struct{char name[9]; char sex;float有下列程序: #include <stdio.h> #include "string.h" typedef struct{char name[9]; char sex;float score[2];}STU; void f(STU A) { STU b={"Zhao",'m',85.0,90.0}; int i; strcpy(a.n

  • 查看答案
  • 有下列程序: #include #include "string.h" voi

    [单选题]有下列程序: include include "string.h" void tim(char *s[],int n)有下列程序: #include <stdio.h> #include "string.h" void tim(char *s[],int n) { char *t;int i,j; for(i=0;i<n-1;i++) for(j=i+1;j<n;j++) if(strlen(s[i])>strlen(s[j])) {t=s[i];s[i]=s[j];s[j]=t;}

  • 查看答案
  • 有下列程序: #include #include "string.h" voi

    [单选题]有下列程序: include include "string.h" void tim(char *s[],int n)有下列程序: #include <stdio.h> #include "string.h" void tim(char *s[],int n) { char *t;int i,j; for(i=0;i<n-1;i++) for(j=i+1;j<n;j++) if(strlen(s[i])>strlen(s[j])) {t=s[i];s[i]=s[j];s[j]=t;}

  • 查看答案
  • 有以下程序:#include#include"string.h"void fun

    [单选题]有以下程序:includeinclude"string.h"void fun(char*s[],int n){char*t;int i,j;for(有以下程序: #include<stdio.h> #include"string.h" void fun(char*s[],int n) { char*t;int i,j; for(i=0;i<n-1;i++) for(j=i+1;j<n;j++) if(strlen(s[i])>strlen(s[j])){t=s[i];s[i]=s[j];

  • 查看答案
  • 下面程序的输出结果是()。#include#include"string.h"v

    [单选题]下面程序的输出结果是()。includeinclude"string.h"void main(){char a[]="Hello T下面程序的输出结果是( )。 #include<iostream.h> #include"string.h" void main() {char a[]="Hello Test",b[]="Test"; strcpy(a,b); cout<<a<<end1; } A) B)C.) D)A.HelloB.TestC.Hello TestD.Hello

  • 查看答案
  • 设有如下程序:#include'string.h"main(){ static

    [单选题]设有如下程序: #include'string.h" main() { static char s1[20],s2[20]; scanf("%s",s1);scanf("%s",s2); if(strcmp(s1,s2)) printf("@"); else printf("$"); printf("%d/n",strlen(strcat(s1,s2))); } 如果从键盘上输入name1<回车>name2<回车>,则程序运行后的输出结果是( )。A.$9B.@11C.$

  • 查看答案
  • 下面程序的输出结果是( )。#include "string.h"fun(cha

    [单选题]下面程序的输出结果是( )。#include "string.h"fun(char*w,int n){ char t,*s1,*s2;s1=w; s2=w+n-1;while(s1<s2){ t=*s1++;*s1=*s2--;*s2=t;}}main(){ static char p[]="1234567";fun(p,strlen(p));printf("%s",p);}A.7654321 B.1717171 C.7171717 D.1711717

  • 查看答案
  • 有下面程序段#include"stdio.h"#include"string.h

    [单选题]有下面程序段 #include"stdio.h" #include"string.h" main() { char a[3][20]={{"china"},{"isa"},{"bigcountry!"}}; chark[100]={0},*p=k; int i; for(i=0;i<3;i++) {p=strcat(p,a[i]);} i=strlen(p); printf("%d/n","i);} 则程序段的输出结果是A.18B.19C.20D.21

  • 查看答案
  • 有如下程序段#include "stdio.h"#include "string

    [单选题]有如下程序段#include "stdio.h"#include "string.h"#define N 10#define M 10char *find(char(*a)[M],int n){ char *q;int i; q=a[0]; for(i=0;i<n;i++) if(strcmp(a[i],q)<0)q=a[i]; return q;}main(){ char s[N][M]={"tomeetme","you","and","he","chin

  • 查看答案
  • 现有如下程序段#include"stdio.h"#include"string.

    [单选题]现有如下程序段 #include"stdio.h" #include"string.h" main() { char a[]="acfijk";/*这里是有序的字符序列*/ char b[]="befijklqswz";/*这里是有序的字符序列*/ char c[80],*p; int i=0,j=0,k=0; while(a[i]!二'/0'&&b[j]!='/0') { if(a[i]<b[j])c[k++]=a[i++]; else iA.acfij

  • 查看答案
  • 有下列程序:#include#include "string.h"typedef