两次运行下面的程序,如果从键盘上分别输入6和3,则输出结果是()。 int x; x=int.Parse(Console.ReadLine()); if(x++>5) Console.WriteLine(x); else Console.WriteLine(x - -);
A.7和5
B.6和3
C.7和4
D.6和4
- · 有4位网友选择 A,占比44.44%
- · 有2位网友选择 B,占比22.22%
- · 有2位网友选择 D,占比22.22%
- · 有1位网友选择 C,占比11.11%
A.7和5
B.6和3
C.7和4
D.6和4
A、7和5
B、6和3
C、7和4
D、6和4
1.实验目的
①掌握结构体型变量的定义和使用。
②掌握结构体型数组的概念和使用。
③掌握链表的概念,初步学会对链表进行操作。
④掌握共用体的概念与使用。
2.实验内容
编程序,然后上机调试运行。
①输入和运行以下程序
union data
{int i[2];
float a;
long b;
char c[4];
}u;
main()
{ scanf("%d,%d",&u.i[0],&u.i[1]);
printf("i[0]=%d,i[1]=%d,a=%f,b=%ld,c[0]=%c,c[1]=%c,c[2]=%c,c[3]=%c",u i[0],u i[1],u.a,u.b,u.c[0],u.c[1],u.c[2],u.c[3]);
输入两个整数10000、20000给u.i[0]和u.i[1],分析运行结果。
然后将scanf语句改为:
scanf(”%ld",&u.b);
输入60000给b,分析运行结果。
②从键盘输入一个人的姓名、年龄、性别和身高,然后将它们打印出来。
③在某个选举区中共有500个选民,有6个候选人,要求编写一个程序来统计并显示每一个候选人的得票数量。
④在一个盒子中有红、绿、蓝、白四种颜色的球各若干。现在需要依次从盒子中取出两个球,问取出的两个球颜色不同的可能取法共有多少?编程打印出可能的取法。
A、7,5
B、6,3
C、7,4
D、6,4
执行如下程序,从键盘依次输入5个整数“5 4 6 7 3”;则输出时B[2]值是_______. #include <stdio.h> #define L 5 int A[L],B[L]; void initial(){ printf("Please input the array:"); for(int i=0;i <l;i++){ scanf("%d",&a[i]); b[i]="i;" } void sort(){ int i,j,count="0;" for(i="0;i<L;i++){" count="0;" for(j="0;j<L;j++){"> j)) count++; } B[i]=count; } } void print(){ int i; printf("Aarry A:\n"); for(i=0;i <l;i++) printf("%d\n",a[i]); printf("array b:\n"); for(i="0;i<L;i++)" printf("%d\n",b[i]); } int main(void){ initial(); sort(); print(); return 0;> A、3
B、4
C、2
D、1
A、6
B、5
C、9
D、15
A、A
B、B
C、C
D、D
A.9
B.3
C.0
D.有语法错误
下面程序的功能是比较用户键盘输入的口令userInput与内设的口令password是否相同。若相同,则输出"Correct password! Welcome to the system...",若userInput <password,则输出"invalid password!user input> password"。 按要求在空白处填写适当的表达式或语句,使程序完整并符合题目要求。 #include <stdio.h> #include <string.h> int main() { char password[7] = "secret"; char userInput[81] ; printf("Input Password:"); scanf(_____________); if ( ______________ ) printf("Correct password! Welcome to the system...\n"); else if ( ___________________) printf("Invalid password!user input <password\n"); else printf("invalid password!user input> password\n"); return 0; }
A、第8行: "%s", userInput 第9行: strcmp(userInput, password) == 0 第11行: strcmp(userInput, password) < 0
B、第8行: "%c", userInput 第9行: strcmp(userInput, password) = 0 第11行: strcmp(userInput, password) < 0
C、第8行: "%s", userInput 第9行: userInput==password 第11行: userInput <password>
D、第8行: "%c", userInput 第9行: strcpy(userInput, password) == 0 第11行: strcpy(userInput, password) < 0
为了保护您的账号安全,请在“简答题”公众号进行验证,点击“官网服务”-“账号验证”后输入验证码“”完成验证,验证成功后方可继续查看答案!