2014/3/19 林中誠老師授課 作業 2014/3/19 林中誠老師授課 作業

#include <stdio.h>

#include <stdlib.h>

#include <string.h>

main()

{

char a[100]={"passwd1"};

char b[100]={"passwd2"};

char c[100]={"passwd3"};

char d[100]={"passwd4"};

char e[100]={"passwd5"};

char k[100];

int i;

 

for(i=0;i<3;i++){

printf("please input Password:\n"); 

scanf("%s",c);

 

 

if(strcmp(k,a)==0) {printf("yes"); break;}

if(strcmp(k,b)==0) {printf("yes"); break;}

if(strcmp(k,c)==0) {printf("yes"); break;}

if(strcmp(k,d)==0) {printf("yes"); break;}

if(strcmp(k,e)==0) {printf("yes"); break;}

printf("no,error\n");

}

 

system("PAUSE");

}

 
2014/3/19 林中誠老師授課 作業二 2014/3/19 林中誠老師授課 作業二

 

#include <stdio.h>

#include <stdlib.h>

#include <string.h>

 

main()

 

{

 

 char aa[10][100]={"passwdone","passwdtwo","passwdthree","passwdfour"};

 int i;

    

    for (i=0;i<=50;i++)

   {

         

    printf("%s\n",aa[i]);       

    } 

 system("pause");

 

}

2014/3/19 林中誠老師授課 作業三 2014/3/19 林中誠老師授課 作業三

 #include <stdio.h>

#include <stdlib.h>
#include <string.h>
main()
{
char a[10][100]={"passwd1","passwd2","passwd3","passwd4",};
 
char c[100];
int i;
int j;
for(i=1;i<4;i++){
printf("please input Password:\n"); 
scanf("%s",c);
 
for(j=0;j<4;j++){
 
if(strcmp(a[j],c)==0) {
printf("yes\n"); 
i=10; 
break;
}
 
}
if(i<10){
 
 printf("no,error\n");
}
}
 
 
system("PAUSE");
}
 
網站地圖 網站地圖