0 like 0 dislike

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

提示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)
Available when: Unlimited - Due to: Unlimited

reshown by | 91 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)
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.101
©2016-2020

Related questions

0 like 0 dislike
3 answers
[Normal] Coding (C) - asked Jan 5, 2017 in 2016-1 程式設計(一)AC
Available when: Unlimited - Due to: Unlimited
| 73 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
| 264 views
0 like 0 dislike
5 answers
[Normal] Coding (C) - asked Dec 27, 2016 in 2016-1 程式設計(一)AC by 410342026 (-105 points)
Available when: Unlimited - Due to: Unlimited
| 112 views
10,784 questions
120,999 answers
113,380 comments
3,816 users