B2002 Hello,World!
puts()函数
使用该函数需要先声明头文件cstdio;
puts(str);//该函数可以用于输出字符串str;输出效果为:输出原字符串并回车;
puts(str+2);//从字符串str中下标为2的字符开始输出;
#include<cstdio>
using namespace std;
int main(){
char str="Hello,World!";
puts(str);
puts(str+2);
return 0;
}
//Hello,World!
//llo,World!
B2025 输出字符菱形
万能头文件
#include<bits/stdc++.h>
P5704 字母转换
字母大小写转化
因为在ASCII码表上,大写字母在前,小写字母在后:
小写字母=大写字母+32,则大写字母=小写字母-32
#include<bits/stdc++.h>
using namespace std;
int main(){
char x;
cin>>x;
if(x>='A'&&x<='Z') cout<<char(x+32);
if(x>='a'&&x<='z') cout<<char(x-32);
return 0;
}