分析题1 下面的代码中可能会存在什么攻击?为什么会形成这种攻击?这种攻击方式有哪些危害。 int main(){ char name[16]; gets(name); for(int i=0;i<16name[i];i++) printf(“%c”,name[i]); }

分析题1 下面的代码中可能会存在什么攻击?为什么会形成这种攻击?这种攻击方式有哪些危害。 int main(){ char name[16]; gets(name); for(int i=0;i<16&&name[i];i++) printf(“%c”,name[i]); }


参考答案和解析
按钮1绑定了事件;当按钮1被点击时,按钮1的值变成“我变了”

相关考题:

有以下程序#include stdio.h#include string.htypedef struct{ char name[9];char sex; float score[2]; } STU;STU 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;i2;i++) a.score[i]=b.score[i];return a;}main(){ STU c={"Qian",'f',95.0,92.0},d;d=f(c); printf("%s,%c,%2.0f,%2.0f\n",d.name,d.sex,d.score[0],d.score[1]);}程序的运行结果是A)Qian,f,95,92B)Qian,m,85,90C)Zhao,m,85,90D)Zhao,f,95,92

有以下程序includeincludetypedef strtlct{char name[9];char sex;floatsc 有以下程序 #include <stdio.h> #include <string.h> typedef strtlct{ char name[9]; char sex;floatscore[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]=bA.Qian,f,95,92B.Qian,m,85,90C.Zhao,f,95,92D.Zhao,m,85,90

有下列程序: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,92B.Qian,m,85,90C.Zhao,f,95,92D.Zhao,m, 85,90

有以下程序#include stdio.h#include string.htypedef 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;i2;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,92B.Qian,m,85,90C.Zhao,f,95,92D.Zhao,m,85,90

定义结构体数组:struct stu{ int num;char name[20];}x[5]={1,"LI",2,"ZHAO",3,"WANG",4,"ZHANG",5,"LIU"};for(i=1;i<5;i++)printf("%d%c",x[i].num,x[i].name[2];以上程序段的输出结果为( )。A.2A3N4A5UB.112A3H41C.1A2N3A4UD.2H3A4H51

C数组名称是指针变量吗? 看这段程序,可是执行。#include stdio.hint main(int argc, char *argv[]){ struct info { char name[33]; int age; }; struct info aa[3]={"meng",20,"juan",29,"an",59}; struct info *p=aa; for(int i=0;i3;i++,p++) printf("%-6s %d\n",p-name,p-age);}将其改成这样:#include stdio.hint main(int argc, char *argv[]){ struct info { char name[33]; int age; }; struct info aa[3]={"meng",20,"juan",29,"an",59}; //struct info *p=aa; for(int i=0;i3;i++,aa++) printf("%-6s %d\n",aa-name,aa-age);}为什么就执行不了呢

c++,运行下面代码出错 #include iostreamusing namespace std;struct student_info{ string name; int chinese; int math; int english;};student_info student[5];void inputinfo(){ int i = 0; char a[20]; for(i = 0;i 5;i++) { cout"enter the "i+1" student's information "endl; cout"enter the name"endl; cina; student[i].name = a; cout"enter chinese performance :"endl; cinstudent[i].chinese; cout"enter math performance :"endl; cinstudent[i].math; cout"enter english performance :"endl; cinstudent[i].english; }}void outputinfo(){ int i = 0; while(i 5) { couti+1" student's information"endl; coutstudent[i].name.c_str()endl; cout"chinese "endl; coutstudent[i].chineseendl; cout"math "endl; coutstudent[i].mathendl; cout"english "endl; coutstudent[i].englishendl; i++; }}int avgfunction(int arr[],int n){ int i = 0; int total = 0; for(i = 0;i n;i++) { total += arr[i]; } return total / n;}void computavg() //这里是否正确?{ int theavg = 0; theavg = avgfunction(student[i].chinese,5); }int main(){ inputinfo(); outputinfo(); computavg(); cin.get(); return 0;} 帮我找出错误 然后改过来 择优为满意答案 不分先后

有以下程序:includeincludeusingnameSpacestd;classperson{ intage; Char*nam 有以下程序:include <iostream>include <string>using nameSpace std;class person{int age;Char * name;public:person ( int i, Char * str ){int j;j = strlen( str ) + 1;name = new char[ j ];strcpy( name, str );age = i;}~person(){delete name;cout<<"D";}void display(){cout<<name<<":"<<age;}};int main(){person demo( 30,"Smith" );demo.display();return 0;}则该程序的输出结果为:【 】。

定义结构体数组: struct stu { int num; char name[20]; }x[5];{1,"L1",2,"ZHAO",3,"WANG",4,"ZHANG",5,"LIU"}; for(i=1;i<5;i++) printf("%d%c",x[i].num,x[i].name[2]); 以上程序段的输出结果为( )。A.2A3N4A5UB.1I2A3H4IC.1A2N3A4UD.2H3A4H5I

已知C源程序如下: include include void reverse(char S[]){ int C,i,J; f 已知C源程序如下:include<stdio. h>include<string. h>void reverse(char S[]){int C,i,J;for(i=0,j=strlen(s)-1;i<j;i++,j++){c=s[i];s[i]=s[j];s[j]=c;}}void getHex(int number,char s[]){int I;i=0;while(number>0){if(number%16<10)s[i++]=number%16+'0';elseswitch(number%16){case 10:s[i++]='A';break;case 11:s[i++]='B';break;case 12:s[i++]='C';break;case 13:s[i++]='D';break;case 14:s[i++]='E';break;case 15:s[i++]='F';break;default:printf("Error");break;}number/=16;}s[i]:'\o';reverse(s);}int main(){unsigned int number;int i=0:char s[50];printf("%s","please input number;\n");scanf("%d",&number):getHex(number,s);i=0;while(s[i])printf("%c",s[i++]);return 0;}画出程序中所有函数的控制流程图。

有以下程序 include include typedef struct { cha 有以下程序 #include <stdio.h> #include <string.h> typedef struct { char name[9]; char sex; float score[2]; } STU; STU 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]; return a; } main() { STU c={"Qian", T, 95.0, 92.0}, d; d=f(c); printf("%s,%c,%2.0f,%2.0f\n", d.name, sex, score[O], d.score[1]); } 程序的运行结果是A.Qian, f,95,92B.Qian,m,85,90C.Zhao,m,85,90D.Zhao,f,95,92

有以下程序struct STU{ char name[10]; int num; int Score;};main(){ struct STU s[5]={{"YangSan",20041,703}, {"LiSiGuo",20042,580}, {"WangYin",20043,680}, {"SunDan",20044,550}, {"Penghua",20045,537}}, *p[5], *t; int i,j; for(i=0;i5;i++) p[i]=s[i]; for(i=0;i4;i++) for(j=i+1;j5;j++) if(p[i]-Scorep[j]-Score) { t=p[i]; p[i]=p[j]; p[j]=t; } printf("%d %d\n",s[1].Score,p[1]-Score);}程序运行后的输出结果是A.550 550 B.580 550 C.680 680 D.580 680

有以下程序: #includestdio.h #includestring.h typedef struct{char name[9];char sex;int score[2];}STU; STU f(STU a) { STU b={"Zha0","m",85,90}; int i; strcpy(a.name,b.name); sex=b.sex; for(i=o;i2;i++)a.score[i]=b.score[i]; return a; } main( ) { STU c={"Qian",f,95,92),d; d=f(c); printf("%S,%C,%d,%d,",d.name,d.sex,d.score[0],d.score[l]); printf("%s,%c,%d,%d\n",C.name,C.sex,c.score[0],C.score[1]); } 程序运行后的输出结果是( )。A.Zhao,m,85,90,Qian,f,95,92B.Zhao,m,85,90,Zhao,m,85m90C.Qian,f,95,92,Qian,f,95,92D.Qian,f,95,92,zhan,m,85,90

有以下程序: #include 〈iostream〉 #include 〈string〉 using namespace std; class visited { private: int number; char *name; public: static int glob; void set mes(char *a); }; void visited::set mes(char *a) { name=new char[strlen(A) +1]; strcpy(name,A) ; number=++glob; } int visited::glob-O; int main() { visited person[10]; int i; char str[8]; for(i=0;i5;i++) { cinstr; person[i] .set mes(str); } coutA.5B.4C.3D.2

有以下程序: struct STU { char name[10]; int num; int score; }; main() { struct STU s[5]={{"YangSan",20041,703},{"LiSiGuo",20042,580}, {"WangYin",20043,680},{"SunDan",20044,550), {'Penghua",20045,537}},*p[5],*t; int i,j; for(i=0;i<5;i++) p[i]=s[i]; for(i=0;i<4;i++) for(j=i+1;j<5;j++) if(p[i]->Score>p[j]->Score) { t=p[i];p[i]=p[j];p[i]=t; } printf("%d %d\n",s[1].Score,p[1]->Score); } 执行后输出结果是( )。A.550 550B.680 680C.580 550D.580 680

定义结构体数组: struct stu { int num; char name[20]; }x[5]={1,"LI",2,"ZHAO",3"WANG",4,"ZHANG",5"LIU"}; for(i=1;i<5;i++) printf("%d %c", x[i].num, x[i].name[2]); 以上程序段的输出结果为( ).A.2A3N4A5UB.1I2a3h4IC.1A2N3A4UD.2H3A4H5I

有以下程序#includestdio.h#includesiring.htypedef struct{char name[9];char sex;int score [2];}STU;STU f(STU a){ STU b={"Zhao",'m',85,90);int i;strcpy(a.name,b.name);a.sex=b.sex:for(i=0;i2;i++) a.score [i]=b.score[i];return a;}main()STU c={"Qian",'f',95,92},d;d=f(c):printf("%s,%c,%d,%d,",d.name,d.sex,d.score[0],d.score[1]);prinff("%s,%c,%d,%d\n",c.name,c.sex,c.score[0],c.score[1]);}程序运行后的输出结果是A.Zhao,m,85,90,Qian,f,95,92B.Zhao,m,85,90,Zhao,m,85,90C.Qian,f,95,92,Qian,f,95,92D.Qian,f,95,92,Zhao,m,85,90

有以下程序 include include typedef stmct{ char name[9];char sex;flo 有以下程序#include <stdio.h>#include <string.h>typedef stmct{ 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,92B.Qian,m,85,90C.Zhao,f,95,92D.Zhao,m,85,90

有以下程序:include struct STU{char name[10]; int num; int Score;};main(){struct 有以下程序: #include <stdio.h> struct STU { char name[10]; int num; int Score; }; main() { struct STU s[5]={{"YangSan",20041,703},{"LiSiGuo",20042,580}, {"WangYin",20043,680},{"SunDan",20044,550}, {"Penghua",20045,537}}, *p[5],*t; int i,j; for(i=0;i<5;i++) p[i]=s[i]; for(i=0;i<4;i++) for(j=i+1;j<5;j++) if(p[i]->Score>p[j]->Score) { t=p[i];p[i]=p[j];p[j]=t;} printf("%d%d\n",s[1].Score,p[1]->Score); } 执行后的输出结果是( )。A.550 550B.680 680C.580 550D.580 680

有以下程序 struct STU { char name[10]; int num; int Score; { main() { struct Stu s[5]={{"YangSan",20041,703},{"LiSiGuo",20042,580}, {"WangYin",20043,680},{"SunDan",20044,550}, {"Penghua",20045;537}},*p[5],*t; int i,j; for(i=0;i<5;i++)p[i]=s[i]; for(i=0;i<4;i++) for(j=i+1;j<5;j++) if(p[i]->Score>p[j]->Score) {t=p[i];p[i]=p[j];p[i]=t;} printf("%d%d\n",s[1].Score,p[1]->Score); } 执行后输出结果是A.550550B.680680C.580550D.580680

试题36有以下程序#include stdio.h#include string.hTypedef struct {char name[9]; char sex; int score[2];}STU;STU f(STU a){ STU b={“Zhao”, ‘m’, 85, 90};int i ;strcpy(a.name, b.name);a.sex=b.sex;for(i=0; i2; i++) a.score[i]=b.score[i];return a;}main(){STU c={“Qian”, ‘f’, 95, 92},d;d=f(c);printf(“%s, %c, %d, %d,”, d.name, d.sex, d.score[0], d.score[1]);printf(“%s, %c, %d, %d\n”, c.name, c.sex, c.score[0], c.score[1]);}程序运行后的输出结果是()A.Zhao, m, 85,90, Qian, f, 95, 92B.Zhao, m, 85,90, Zhao, m, 85, 90C.Qian, f, 85,90, Qian, f, 95, 92D.Qian, f, 95, 92, Zhao, m, 85, 90

char name[10]=“Mary”;char*pName=name;int i=5;对上面语句描述错误的是()。A、name和pName有相同的值B、name[0]和pName有相同的值C、name+i和pName+i有相同的值D、*(name+i)和(*pName+i)有相同的值

单选题有以下程序#include #include typedef struct{ char name[9]; char sex; float score[2];} STU;STU 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; i2; i++) a.score[i]=b.score[i]; return a;}main(){ STU c={Qian,'f',95.0,92.0},d; d=f(c); printf(%s,%c,%2.0f,%2.0f, d.name, d.sex, d.score[0], d.score[1]);}程序的运行结果是(  )。AQian,m,85,90BZhao,m,85,90CQian,f,95,92DZhao,f,95,92

单选题有以下程序:#include #include 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; i2; 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, c.name, c.sex, c.score[0], c.score[1]);}程序的运行结果是(  )。AQian,f,95,92BQian,m,85,90CZhao,f,95,92DZhao,m,85,90

单选题有如下程序:#include main(){ char name[10] = {'S','T','R','I','N','G'}; name[3]='E'; name[5]=0; printf(%s,name);}程序运行后的输出结果是(  )。ASTRENGBSTRIEGCSTRENDSTREN0

单选题char name[10]=“Mary”;char*pName=name;int i=5;对上面语句描述错误的是()。Aname和pName有相同的值Bname[0]和pName有相同的值Cname+i和pName+i有相同的值D*(name+i)和(*pName+i)有相同的值

单选题有以下程序#include #include typedef struct{ char name[9]; char sex; int score[2];} STU;STU f(STU a){ STU b={zhao,'m',85,90}; int i; strcpy(a.name, b.name); a.sex = b.sex; for(i=0; i2; i++) a.score[i]=b.score[i]; return a;}main(){ STU c={Qian,'f',95,92},d; d=f(c); printf(%s,%c,%d,%d,, d.name, d.sex, d.score[0], d.score[1]); printf(%s,%c,%d,%d, c.name, c.sex, c.score[0], c.score[1]);}程序运行后的输出结果是(  )。AZhao,m,85,90,Qian,f,95,92BZhao,m,85,90,Zhao,m,85,90CQian,f,95,92,Qian,f,95,92DQian,f,95,92,Zhao,m,85,90

问答题给定程序通过定义并赋初值的方式,利用结构体变量存储了一名学生的学号、姓名和3门课的成绩。函数fun的功能是将该学生的各科成绩都乘以一个系数a。  请在程序的下画线处填入正确的内容并把下画线删除,使程序得出正确的结果。  注意:部分源程序给出如下。  不得增行或删行,也不得更改程序的结构!  试题程序:#include #include typedef struct{ int num; char name[9]; float score[3];} STU;void show(STU tt){ int i; printf(%d %s:,tt.num,tt.name); for(i=0; i3; i++) printf(%5.1f,tt.score[i]); printf();}/*********found*********/void modify(①______ *ss,float a){ int i; for(i=0; i3; i++)  /*********found*********/  ss-②______*=a;}main(){ STU std={1,Zhang,76.5,78.0,82.0}; float a; printf(The original number and name and scores:); show(std); printf(Input a number:); scanf(%f,a); /*********found*********/ modify(③______,a); printf(A result of modifying:); show(std);}