首页 > 其他 > 详细

字符数据的运算及输出

时间:2018-08-02 10:47:44      阅读:123      评论:0      收藏:0      [点我收藏+]
 1 #include <iostream>
 2 
 3 /* run this program using the console pauser or add your own getch, system("pause") or input loop */
 4 using namespace std;
 5 int main(int argc, char** argv) {
 6     
 7     //字符类型变量的声明
 8     char c1=A;
 9     char c2;
10 
11     //字符数据的运算及输出
12     c2=c1+32;
13     cout<<"c1="<<c1<<endl;
14     cout<<"c2="<<c2<<endl;
15 
16     //输出字符及ASCII码    
17     cout<<c1<<" : "<<int(c1)<<endl;
18     cout<<c2<<" : "<<int(c2)<<endl;
19     cout<<$<<" : "<<int($)<<endl;
20     
21     //输入字符
22     cout<<"c1 c2"<<endl;
23     cin>>c1>>c2;
24     cout<<"c1="<<c1<<"  c2="<<c2<<endl;
25     return 0;
26 }

 

字符数据的运算及输出

原文:https://www.cnblogs.com/borter/p/9405664.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!