c语言:给定一个大写字母,用小写字母输出

给定一个大写字母,用小写字母输出
程序:
#include<stdio.h>
int main()
{
char   c1,c2;
printf("请输入一个大写字母:");
scanf("%c", &c1);
c2=c1+32;
printf("c2=%c\nc2=%d\n", c2,c2);
return 0;
}
结果:
请输入一个大写字母:A
c2=a
c2=97
请按任意键继续. . .
时间: 2024-08-26 09:06:01

c语言:给定一个大写字母,用小写字母输出的相关文章

【c语言】给定一个大写字母,要求用小写字母输出

// 给定一个大写字母,要求用小写字母输出 #include <stdio.h> int main() { char c; printf("请输入一个大写字母:"); scanf("%c",&c); c = c + 32; printf("该大写字母的小写是:%c\n",c); return 0; }

从终端获取一个字符串,分别统计其中大写字母、小写字母、数字及其它字符的个数。

//从终端获取一个字符串,分别统计其中大写字母.小写字母.数字及其它字符的个数. #include<stdio.h> #include<stdio.h> int main(int argc,const char *argv[]) { char str[100]; char ch; int len,i; int letter = 0, number = 0, space = 0, other = 0; gets(str); for(i=0;i<strlen(str);i++)

计算一个字符串中大写字母、小写字母、特殊字符、数字的个数

1 public class Test_123_Test { 2 public static void main(String[] args) { 3 String str = "[email protected]#¥%……&"; 4 int bigs = 0;// 记录大写字母的个数 5 int smalls = 0;// 记录小写字母的个数 6 int others = 0;// 记录其他字符的个数 7 int shuzi = 0; 8 System.out.println

汇编语言——统计一个字符串中的大写字母、小写字母、数字和其他字符的个数,并显示

;统计字符串中大写字母.小写字母.数字.其他字符的个数DATAS SEGMENT buf db '12ADdf#gh592HKL*','$' tp1 db 0;大写字母个数 tp2 db 0;小写字母个数 tp3 db 0;数字的个数 tp4 db 0;其他字符的个数 str1 db 'the number of big is:','$' str2 db 'the number of small is:','$' str3 db 'the number of number is:','$' st

程序一 用记事本建立文件src.dat,其中存放若干字符。编写程序,从文件src.dat中读取数据,统计其中的大写字母、小写字母、数字、其它字符的个数,并将这些数据写入到文件test.dat中。

用记事本建立文件src.dat,其中存放若干字符.编写程序,从文件src.dat中读取数据,统计其中的大写字母.小写字母.数字.其它字符的个数,并将这些数据写入到文件test.dat中. #include<stdio.h>#include<stdlib.h>#include<string.h>int main(){ FILE*fp1,*fp2; char ch; int da=0,xiao=0,shuzi=0,qita=0; if((fp1=fopen("sr

位操作,大写字母转成小写字母,小写字母转成大写字母

----------------------------------------------------------------------------------------------------------------------------------------------------------------- #include <stdio.h> void main () { //不懂是谁发现的,大写字母和小写字母在二进制位上只相差一位 //大写字母二进制位的第6位为0 //小写字

(转)求正则表达式,密码必须包含大写字母、小写字母、数字

1.必须只能是 大写字母.小写字母和数字构成的密码2.大写字母.小写字母.数字都至少出现一次 import java.util.regex.Pattern; import java.util.regex.Matcher; public class RegexRegexTest2 { public static boolean checkPassword(String password){ if(password.matches("\\w+")){ Pattern p1= Pattern

php字符串英文文本中大写字母,小写字母,空格,标点符号的个数统计

对一段英文文本的信息,统计其中大写字母,小写字母,空格,标点符号的个数 <?php$manuscript = "Where there is a will, there is a way.";//字符串文本$smallLetter = 0;$capitalLetter = 0;$blank = 0;$punctuation = 0; $num=strlen($manuscript);$arr=str_split($manuscript);//字符串分割为数组foreach($ar

找出字符串有有多少个大写字母、小写字母及其它

public class TestStringCharAt { /** * 找出字符串有有多少个大写字母.小写字母及其它 */ public static void main(String[] args) { String str = "[email protected]"; char ch = 0; int upperNum = 0; int lowerNum = 0; int otherNum = 0; /** * 方法一 * for (int i=0;i<str.lengt