码迷,mamicode.com
首页 > 其他好文 > 详细

字符数据的运算及输出

时间:2018-08-02 11:18:36      阅读:144      评论:0      收藏:0      [点我收藏+]

标签:loop   span   use   mes   argc   bsp   getc   NPU   输入   

 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 }

 

字符数据的运算及输出

标签:loop   span   use   mes   argc   bsp   getc   NPU   输入   

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

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!