正在加载图片...
样例输出 yes 参考答案: #include<bits/stdc++.h>/C++的万能头文件 #include <cmath> using namespace std; int main() int x,y; cin >>x >>y; if(×>=-1&&x<=1&&y>=-1&&y<=1) { cout <"yes"<<endl; else { cout <"no"<<endl; return 0; 4从键盘输入一个字符,判断是字母,还是数字,还是其他符号 #include<bits/stdc+.h>/C+的万能头文件 using namespace std; int main() { char ch; cin >ch; if(ch>='a'&&ch<='z'ch >='A'&&ch<='Z') { cout<"是字母"<endl; } else if(ch>=0'&&ch<='9') { cout<"是数字"<endl; } else cout<"是其他字符"<endl; return 0; } 5输入一个字符,如果是大写字母,则把其变成小写字母:如果是小写字母,则变成大写 字母:其它字符不变 #include<bits/stdc+.h>/C+的万能头文件样例输出 yes 参考答案: #include <bits/stdc++.h> //C++的万能头文件 #include <cmath> using namespace std; int main() { int x,y; cin >>x >>y; if( x >= -1 && x <= 1 && y >= -1 && y <= 1 ) { cout << "yes" <<endl; } else { cout << "no" <<endl; } return 0; } 4 从键盘输入一个字符,判断是字母,还是数字,还是其他符号 #include <bits/stdc++.h> //C++的万能头文件 using namespace std; int main() { char ch; cin >> ch; if( ch >= 'a' && ch <= 'z' || ch >= 'A' && ch <= 'Z') { cout << "是字母"<<endl; } else if( ch >= '0' && ch <= '9' ) { cout << "是数字"<<endl; } else { cout << "是其他字符"<<endl; } return 0; } 5 输入一个字符,如果是大写字母,则把其变成小写字母;如果是小写字母,则变成大写 字母;其它字符不变 #include <bits/stdc++.h> //C++的万能头文件
<<向上翻页向下翻页>>
©2008-现在 cucdc.com 高等教育资讯网 版权所有