0 like 0 dislike
請撰寫一個程式,其程式讓使用者設定密碼,密碼需有英文字母及數字且字數在6到10字間,若其中一條件不符合則輸出error,若都符合則輸出finish。

範例輸入1  ffg2573

範例輸出1  finish

範例輸入2  54454589712

範例輸出2 error
[Normal] Coding (C) - asked in 2016-1 程式設計(一)AC
Available when: Unlimited - Due to: Unlimited

reshown by | 73 views

3 Answers

0 like 0 dislike
Hidden content!
**** * * * * ** *

** * *****

** * ** * **



int main (void)

{ * ** ** ** ****
** ** * **** *** * * a=0,b,c=0,d=0,k;

* * ***** ** **** *** s[99];



* *** ** **** * ("%s",s);

*** ****** *** * ** *** ** *

* *** * * ** ** *
** * **** * *** ** ** * * * || a>10)

* ** ***** ** * **** ** *  
** ** * * ** * **** * (k=0;k<a;k++)

** ** * * ** *

* * * *** * * *** * ** (isalpha(s[k]))

** * * * * ** **** *

* * * * **** ** (isdigit(s[k]))

** * ** * *** *

* ** *** **** *** * ** **   


*** * * ***** * ** (d+c!=a)

* *** ** * ** *** * * **

*** * * * ** *** (d==0||c==0)

* ** * * * * **

** ***** * *** ** * ** *

** ** ** **** * * *** **** * *** ** *** ** *

* ** * *** ** * * * * ** * *

* ** * * *** * ***** ** ** ** * ** * ***



 
* * * * * * *** ** * * * 0;

}
answered by (-122 points)
0 like 0 dislike
Hidden content!
* ****** * ** * *

*** *** * * *

* ** * ***** *

* ** * *



int main (void)

{ ** * *** * *
* ** **** *** * *** *** ** * a=0,b,c=0,d=0,i,k,j;

** ** ** * **** ** s[99],z[a-1];



** * * * * ** ** * * ("%s",s);

*** * * * * * ** **

* *** * * * * * ***** * *
* * * * *** ** * * || a>10)

** ** * ** ** ** *  
* * ** * **** **** * *** (i=0;i<a;i++)

* ****** *** *** * * *

* *** ** *** (isalnum(s[i]))

** ** *** ** * * ** *****

** * **** * * * ***

* ** *** * *** * * ** *** (c!=a)

** * * *** **** * ***** ***

*** * ** ** * ** *** * (k=0;k<a;k++)

******* *** ***** **

**** ** * ** * ** (isalpha(s[k]))

*** * * * *** * * * ****

* ** * **** * ** * * ** (isdigit(s[k]))

* * ***** ****** * ***

* ** **** ** * * ** *   


* **** ** * * (d+c!=a)

*** ******* * * * ** ** * * *

** * * * ** ** ***** ** (d==0||c==0)

* * ** ** * ** * ** ****

* ** ** *** * ** ** **** * ** *

*** *** * * *** ******** *** * * ** ** *

**** * ** * ** * * * ** *

* **** * ** * * * ** * ***** ** **



 
*** ** ********* *** * * *** ** 0;

}
answered by (-102 points)
0 like 0 dislike
Hidden content!
**** * * ** * *
* ** * * *** *
* ** * * ** *** ** **
* * ** ** * * *



int main (void)

{ **** ** *
* * * ** * ****** * * * ** ***
******* * * * **** ** * s[99],z[a-1];


***** * ** ****** * ** * * ** * * ** ** * ***
** * ** ** ***** * * **
***** ***** *
*** * * * **** * ** || a>10)
* *** * * * * ** ** **

* *** * * ** **** *** * * * **
* ** ** ***** * * *
* ** *** ** * **** * (isalnum(s[i]))
*** ** * * ** * *** *
* *** ** ** * * ** * **
** **** * ******* **** * * (c!=a)
** * *** **** ** * * **
***** * * ** * * ***** (k=0;k<a;k++)
* * * ** *** * *
* * ** ***** * ** * * ** (isalpha(s[k]))
***** * * *** * ** * **
* *** **** * **** * *** (isdigit(s[k]))
* ** * * * ** *** * * * *
** * *** * * * ** * *** *  



    if (d+c!=a)

    b=1;

    if (d==0||c==0)

    b=1;
* * **** ** ******* ** * *
** * *** * * ** * ** *** *
* ** *** **** * * * * * *****
**** *** ** * *** ** ** * ***** *





    return 0;

}
answered by (-136 points)
Get it on Google Play Welcome to Peer-Interaction Programming Learning System (PIPLS) LTLab, National DongHwa University
English 中文 Tiếng Việt
IP:173.245.54.72
©2016-2020

Related questions

0 like 0 dislike
3 answers
[Normal] Coding (C) - asked Jan 3, 2017 in 2016-1 程式設計(一)AC by 410425014 (-162 points)
Available when: Unlimited - Due to: Unlimited
| 91 views
0 like 0 dislike
23 answers
[Normal] Coding (C) - asked Dec 13, 2016 in 2016-1 程式設計(一)AC by HoMingJui (-126 points)
Available when: Unlimited - Due to: Unlimited
| 229 views
2 like 0 dislike
14 answers
[Normal] Coding (C) - asked Dec 21, 2016 in 2016-1 程式設計(一)AC
Available when: Unlimited - Due to: Unlimited
| 171 views
0 like 0 dislike
7 answers
[Normal] Coding (C) - asked Jan 5, 2017 in 2016-1 程式設計(一)AC by 林佳慧 (-85 points)
Available when: Unlimited - Due to: Unlimited
| 87 views
0 like 0 dislike
31 answers
[Normal] Coding (C) - asked Jan 3, 2017 in 2016-1 程式設計(一)AC
Available when: Unlimited - Due to: Unlimited
| 262 views
10,769 questions
120,708 answers
112,852 comments
3,802 users