8.輸入一個大寫字母,要求小寫字母輸出
1 #include <stdio.h> 2 #include <stdlib.h> 3 4 int main() 5 { 6 char a,c1; 7 scanf("%c",&a); 8 c1 = a+32; //大寫字母與小寫字母的ASCII碼相差32,‘a’=97,‘A’=97-32=65 9 printf("%c\n",c1);//%c按字元型輸出 10 printf("%d\n",c1); //%d按十進位制型輸出 11 return 0; 12 }
相關推薦
8.輸入一個大寫字母,要求小寫字母輸出
1 #include <stdio.h> 2 #include <stdlib.h> 3 4 int main() 5 { 6 char a,c1; 7 scanf("%c",&a); 8 c1 = a+32; //大寫字母與
python 輸入一個字符,是小寫轉換為大寫,大寫轉換為小寫,其他字符原樣輸出
style pre clas input span pan NPU pri code s = input(‘請輸入一個字符:‘) if ‘a‘ <= s <= ‘z‘: print(chr(ord(s) - 32)) elif ‘A‘ <
c語言從鍵盤中輸入一串字串,將字元中的大寫轉化成小寫字母,將小寫字母轉換成大寫字母,以*號鍵結束
#include <stdio.h> int main(int argc, const char * argv[]) { char c; c=getchar(); while (c!='*') { if(c
取字串首字母變更為大寫字母,其餘小寫字母(兩種方法 substring()與charAt())。
package demo_取部分字串將其轉換大小寫; public class toUpperCaseAndtoLowerCase { public static void main(String[] args) { toConvert("sdfdsgre")
從鍵盤輸入一個大寫字母,要求改用小寫字母輸出
import java.util.Scanner; public class Aa {public Aa(){}public static void main(String[] args) {Aa aa=new Aa();Scanner scan=new Scanner(System.in);Str
python 從鍵盤輸入一個字串,將小寫字母全部轉換成大寫字母,將字串以列表的形式輸出(如果字串包含整數取整型)?
str1 = input("請輸入任意字串: ") list1= [] #儲存字串 list2= [] #儲存數字 for i in str1: if i.isdigit() == True: #判斷當前字元是否為字元 list2.append(int(i)) else:
練習:輸入一個小寫字母,輸入一個大寫字母。
#include <stdio.h>int main(void){ char a; char red; printf("請輸入一個小寫字母:"); scanf("%c",&a); red = a - 32; printf("%c的大寫字母是:%c",a,red);
給一個字串,有大小寫字母,要求寫一個函式把小寫字母放在前面 大寫字母放在後面,儘量使用最小空間,時間複雜度。(即用指標做)。 如:aAbBcCdD ---àabcdABCD
#include <stdlib.h> int SmallToCaptial( char *str, char *outbuf ) {char *p = str;if (str == NULL || outbuf == NULL){return -1;}while (*p){if (*p >
輸入一個字串將其中的大寫字母改為 小寫字母 ,小寫改為大寫字母
import java.util.Scanner;class Ti62{ public static void main(String args[]){Scanner sc=new Scanner(System.in);System.out.println("請輸入一
c程序設計 8.15寫幾個函數:①輸個職工的姓名和職工號;②按職工號由小到大順序排序,姓名順序也隨之調整;③要求輸入一個職工號,用折半法找出該職工的姓名,從主函數輸入要查找的職工號,輸出該職工
xmx ebr ckey ros lbp loj ase vfk cu2 8.15寫幾個函數:①輸個職工的姓名和職工號;②按職工號由小到大順序排序,姓名順序也隨之調整;③要求輸入一個職工號,用折半法找出該職工的姓名, 從主函數輸入要查找的職工號,輸出該職工。 寫的時候為
python3 自己編寫一個程式,把大寫字母轉換為小寫字母(即自程式設計實現了 字串的lower()方法)
#定義一個函式,可以把列表輸入的帶有大寫字母的列表,轉換為全小寫字母 #比如:輸入列表['Hello','worlD','HAHA'] ====> ['hello','world','haha'] #程式碼如下: #定義一個函式,可以把列表輸入的帶有大寫字母的列表
輸入2個字串s1和s2,並拼接成一個新的字串,新字串中只包含s1和s2中所有小寫字母,並且按照字母從小到大排序
#include<stdio.h> #include <stdlib.h> #include<string.h> char *str_merge(char *s1,
首字母變大寫 --輸入一個英文句子,將每個單詞的第一個字母改成大寫字母。
題目描述: Problem Description 輸入一個英文句子,將每個單詞的第一個字母改成大寫字母。 Input 輸入資料包含多個測試例項,每個測試例項是一個長度不超過100的英文句子,佔一行。
共享一個目錄,任何人都可訪問,不用輸入密碼即可訪問,要求只讀
目錄 eve lob host etc server 工作組 ini main 1、服務端配置 [[email protected]/* */ ~]# yum install -y samba samba-client # 安裝 Samba [[e
在i.jsp 中,url地址欄輸入一個參數,值是整型,要求倒著輸出
lang 輸出 spa span url request parameter out getpara <% String k = request.getParameter("k"); int tt = Integer.parseInt(k); out.println(
輸入一個字串,找出其中以“b”開頭的字母,空格分割字母
#include<stdio.h> //找出以“b”為開頭的字母 #include<string.h> int main() { char string[100]; int count=0; printf("請輸入字串
大家都知道斐波那契數列,現在要求輸入一個整數n,請你輸出斐波那契數列的第n項(從0開始,第0項為0)。
題目描述 大家都知道斐波那契數列,現在要求輸入一個整數n,請你輸出斐波那契數列的第n項(從0開始,第0項為0)。 n<=39 /* 思路: 就是簡單的斐波那契數列,按照正常的思路求解即可 可以分為遞迴和非遞迴,這裡介紹非遞迴的方式 */ class Solution { pub
AMNO.6題目描述 給出一個不多於5位的整數,要求 1、求出它是幾位數 2、分別輸出每一位數字 3、按逆序輸出各位數字,例如原數為321,應輸出123 輸入 一個不大於5位的數字 輸出 三
題目描述 給出一個不多於5位的整數,要求 1、求出它是幾位數 2、分別輸出每一位數字 3、按逆序輸出各位數字,例如原數為321,應輸出123 輸入 一個不大於5位的數字 輸出 三行 第一行 位數 第二行 用空格分開的每個數字,注意最後一個數字後沒有空格 第三行 按逆
java實現斐波那契數列,現在要求輸入一個整數n,請你輸出斐波那契數列的第n項。 n
public class Solution_feibonaqi { public int Fibonacci(int n) { int result[] = { 0, 1 }; if (n < 2) { return result[n];
java 把字串中的小寫字母換成大寫字母,大寫字母換成小寫字母
publicstatic String convert(String str){char[] cArray = str.toCharArray(); StringBuffer sb =new StringBuffer();for(int i=0; i<cArray.length; i++