c語言程式設計題 從鍵盤輸入字元,輸出與該字元前後相鄰的兩個

2021-05-16 23:03:00 字數 2700 閱讀 5199

1樓:匿名使用者

char ch;

scanf(" %c",&ch);

printf("%c %c\n",(char)(ch-1),(char)(ch+1));

printf("%d %d\n",(ch-1),(ch+1));

2樓:匿名使用者

#include

int main(void)

編寫程式輸入一個字元ch然後輸出與它前後相鄰的兩個字元

3樓:自我程式設計

你的問題不太明白,是輸入任意一個字元,輸出其ascii碼前後相鄰的兩個字元。

還是說,已有一個字串,輸入其中一個字元,輸出其前後相鄰的兩個字元。

求c語言程式設計,今天的作業!輸入一個英文字元,求其ascii碼和其前後相鄰

4樓:匿名使用者

#include

int main()

c語言輸入一個字元輸出字元鍵盤上的相鄰字元

5樓:汐_楓

#include

void main()

,,};//初始化鍵盤表可以照鍵盤增刪,並改動//3和11就行了,這裡只限字母

scanf("%c",&c);

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

for(j=0;a[i][j]!='\0';j++)if(c==a[i][j]||c==a[i][j]-32)//大小寫字母

printf("無該字母。\n");}

6樓:耿利兒

#include

int main()

鍵盤上兩個鍵位之間沒有規律,而是因為我們對打字使用字母對習慣進行排列的。所以,如果要實現你的要求(鍵盤上的前後順序),是有很大的困難的。

7樓:匿名使用者

你好!!

要實現這樣的功能,你先要建立一個鍵盤陣列,然後根據輸入的字母,顯示陣列內容

關於c語言的一道程式設計題,求大神解答! 從鍵盤輸入一個字串存入一個字元陣列中,其中任意兩個相鄰字元 10

8樓:稀哩嘩啦嘎嘎

|#include

#define n 99

int main()

i++;

}for(j=0;j

return 0;

} 題意不清啊

用c語言編寫:從鍵盤輸入兩個字元,要求輸出這兩個字元,並輸出它們的ascii碼及其ascii碼的平方和的平方根

9樓:匿名使用者

1 用getchar輸入兩個字元。

2 用%d的格式,同過printf輸出ascii碼值。

3 計算平方和,並利用sqrt求平方根。

4 輸出平方根。

**:#include

#include

int main()

10樓:匿名使用者

#include

#include

main()

11樓:匿名使用者

#include

#include

void main()

12樓:匿名使用者

include

include

uisng namespace std;

int main()

13樓:金色潛鳥

假定不允許用 printf() 函式,只允許 用getchar 輸入,和putchar函式 輸出,程式如下:

#include

#include

int main( )

例子:input 2 chars:

aba:65

b:66

92.6337

14樓:匿名使用者

#include

intmain()

c語言程式:題目:從鍵盤輸入一個字串,按照字元順序從小到大進行排序,並要求刪除重複的字元。答案如下

15樓:匿名使用者

#include

#include"string.h"

int main(void)

,str2[256]=;//定義二個陣列,並賦初值為0int i;

gets(str1);//讀取一個字串

for(i=0;str1[i];i++)

for(i=0;i!=256;i++)

if(str2[i]==1)//判斷陣列中被str1填充的位置,填充的是非0值,沒填充的是0值

printf("%c",i);//輸出str2的下標值,對應str1中的字元值

putchar('\n');

return 0;}

c語言程式設計 從鍵盤輸入一個字元 則輸出其後的字元例如 輸入a輸出b

16樓:影流天

#include

int main()

17樓:匿名使用者

#include

int main()

C語言 用字元陣列從鍵盤輸入字串,刪除字串中所有

1 遍歷字串 2 對每個字元 判斷,如果不是字母,則刪除。刪除可以通過後續字元前專移,覆蓋要刪 屬除字元的方式實現。如下 int main s j 0 printf s n s include include include int main str2 j 0 printf s str2 getch...

C語言程式設計從鍵盤輸入字串,將其中所有的數字字元抽出,按原順序組成新串並輸出

include stdio.h int main void include stdafx.h if the vc 6.0,with this line.include stdio.h int main void include int main s i 0 printf s n s return 0...

c語言程式設計有整數a,b,c,由鍵盤輸入,輸出其中最大的

include int main 一樓也是正解啊 這問號表示式用的 剛剛滴啊 三目運算子做的 include void main 像這樣的程式 建議多想一下,include int main include void main 例 輸入三個整數,輸出最大數和最小數。main else if max ...