0 like 0 dislike
224 views

請設計一個程式,使用者會輸入一個字串,字串的內容只會包含大小寫的英文字母,並且用兩相鄰英文字母的「距離」當做作密碼。

提示1:「距離」利用ASCII碼所對應的來計算 例如R=82, O=79, 82- 79= 3

提示2: 所有小寫字母轉為大寫 a→A

 

範例輸入:

ROY
roY
ndHu
NDHU

範例輸出:

3 10 
3 10 
10 4 13 
10 4 13 
[Normal] Coding (C) - asked in 2016-1 程式設計(一)AC by (-162 points)
ID: 20514 - Available when: Unlimited - Due to: Unlimited

reshown by | 224 views

3 Answers

0 like 0 dislike
Best answer
Hidden content!
#include * ** * ****

#include **** ** ***** *

#include ** ** ** *

void test(char *t);

int main()

{
* * *** ** ** * ** s[30],s2[30];
**** ** * ** ** * * * * * * ** ** * != EOF)
* ***** * ** ******* ** * *** * * ****** * * *



}

void test(char *t)

{
* *** * * ** * * * i,result;


** *** * * ** *** * (i=0; i<strlen(t); i++)
*** * *** ***** ** ** * *** ** ** *
* ** * * * * ** * * * ** * ***** * * * * **** ** * * = toupper(t[i]);
*** * ** ** ** * * * ** * *** ****


*** ** ** * * * **** (i=0; i<strlen(t)-1; i++)
**** ***** ** *** * ** *
* * * ** *** * **** * * * *** ** * * * * * *** = t[i]-t[i+1];
* ******** * ** *** * * ** *** * * ** ** * * * (result<0)
* *** ***** *** *** * *** *** ** * * * * * *** *** * * * * *** ",-result);
** * * * * * *** * *** ** *** **** *** * * *
** ** ***** ** * *** ** ** **** * * ** ** ** **** *** ** ** *** ",result);
* * * **** * **** * *

}
answered by (-162 points)
0 like 0 dislike
Hidden content!
#include<stdio.h>

#include<stdlib.h>

#include<string.h>

#include<ctype.h>

int main(void)

{
*** * ****** **** ** * s[100];
* **** ** * * ** * schange[100];
** * ** * ** * ** len;
* ** * *** *** * ** i;
**** * * *** * ** * ** num;
* * ** ** ** ** ** **** ***** *** *** ** * *
** * ** * ** * * * ** **
** ****** * * ** * * * ** ** *
** ** * ** **** * *
***** * * * * ** ** * ** ** *** * *** * * * **
* ** * * * * * *** *** * ** * ********** *** ** * * ** **
** * * **** *** ***** *** **** * ****
* *** *** * *** * * ***** * **** * ** ** **** * *
* ** ** * ***** ****** *
*** *** * * * **** * * (i=0;i<len-1;i++)
*** * * * *** ** ** ***
* * * * * * * * * ******* ** ******** * -schange[i];
* * ** * **** ** *** * ** * * * ** ***** ** ** * ",abs(num));
** * ** * ** ***

}
answered by (-124 points)
0 like 0 dislike
Hidden content!
#include <stdio.h>

#include *** * * * * ** **

#include *** * ** * *

int main()

{
******* ** *** *** s[30],s2[30];
* * * ** *** ** ** * *** ** * * * * * != EOF)
* * * * ** * *** ** ******* * * * * ***** *



}

void test(char *t)

{
** *** ** * **** * * i,result;


* *** *** ** * * ** * ** (i=0; i<strlen(t); i++)
* * * * **** ** * * * * *** *** * ** *
* ** * * * * *** *** *** ** * * * ** ** ** * * * = toupper(t[i]);
* * * **** * * * ** ***** * *** *


* * ** * * ***** *** * * (i=0; i<strlen(t)-1; i++)
* ** ** **** ** **** *
* * *** * * ** * *** *** * **** * **** * * * = t[i]-t[i+1];
** * * *** * * *** * * * * **** **** * (result<0)
** * * ** * * ** ****** ****** * **** **** * *** ****** * * **** * * ** ",-result);
* ******** * * * * *** * * ** ** ** * *** ****
*** * *** *** * ** *** ***** * * * * ** *** * ** * * * * * * **** ** **** ",result);
** *** * ** *** * * ** *

}
answered by (-162 points)
Welcome to Peer-Interaction Programming Learning System (PIPLS) LTLab, National DongHwa University
English 中文 Tiếng Việt
IP:172.70.131.6
©2016-2024

Related questions

0 like 0 dislike
3 answers
[Normal] Coding (C) - asked Jan 5, 2017 in 2016-1 程式設計(一)AC
ID: 20997 - Available when: Unlimited - Due to: Unlimited
| 198 views
2 like 0 dislike
14 answers
[Normal] Coding (C) - asked Dec 21, 2016 in 2016-1 程式設計(一)AC
ID: 19745 - Available when: Unlimited - Due to: Unlimited
| 438 views
0 like 0 dislike
7 answers
[Normal] Coding (C) - asked Jan 5, 2017 in 2016-1 程式設計(一)AC by 林佳慧 (-85 points)
ID: 20976 - Available when: Unlimited - Due to: Unlimited
| 274 views
0 like 0 dislike
31 answers
[Normal] Coding (C) - asked Jan 3, 2017 in 2016-1 程式設計(一)AC
ID: 20482 - Available when: Unlimited - Due to: Unlimited
| 986 views
0 like 0 dislike
5 answers
[Normal] Coding (C) - asked Dec 27, 2016 in 2016-1 程式設計(一)AC by 410342026 (-105 points)
ID: 20135 - Available when: Unlimited - Due to: Unlimited
| 292 views
12,783 questions
183,443 answers
172,219 comments
4,824 users