题目内容

下面程序的功能是比较用户键盘输入的口令userInput与内设的口令password是否相同。若相同,则输出"Correct password! Welcome to the system...",若userInputpassword"。按要求在空白处填写适当的表达式或语句,使程序完整并符合题目要求。#include #include 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 inputpassword\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 D. 第8行:"%c", userInput第9行:strcpy(userInput, password) == 0第11行:strcpy(userInput, password) < 0

查看答案
更多问题

下列对字符串的定义中,错误的是

A. char str[7] = "FORTRAN";
B. char str[] = "FORTRAN";
C. char *str = "FORTRAN";
D. char str[] = {'F','O','R','T','R','A','N',0};

以下不能打印字符串cde的代码片段是()

A. char s[]="abcde",*p;p=s;printf("%s",p+2)
B. char s[]="abcde";printf("%s",s+2);
C. char s[]="abcde",*p;p=s+2;printf("%s",p);
D. char s[]="abcde";s+=2;printf("%s",s);

以下sizeof运算的结果不为1的是

A. sizeof('0')
B. sizeof("")
C. sizeof('\x21')
D. sizeof("a")

执行程序段char str[20]={'a','b','c','\0'}; int len=strlen(str); 变量len的值为( )

A. 20
B. 4
C. 3
D. 3或4或20

答案查题题库