字符串
#include<stdio.h>
#include<stdlib.h>
#include<string.h>
void login();
void main(){
login();
system("pause");
}
void login(){
printf("请输入用户名:");
char userName[20];
gets(userName);
printf("请输入密码:");
char passWord[20];
gets(passWord);
if(!strcmp(userName,"admin")&&!strcmp(passWord,"123456")){
printf("登陆成功\n");
}else{
printf("登录失败\n");
}
}
char a[]="小明";
int i = strlen(a);
int j = strlen("黄晓明");
printf("%d\n",i);
printf("%d\n",j);
char source_string[] = "is very good";
char target_string[30] = “zzsxt";
strcat(target_string,source_string);
printf("\n 源字符串 = %s", source_string);
printf("\n 目标字符串 = %s\n", target_string);
网友评论