首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > 开发语言 > C++ >

入门级C++有关问题

2012-02-19 
入门级C++问题char temp aprintf(%c\t%d\n,temp,temp)这句C用C++的cout怎么写???求教[解决办法]C/

入门级C++问题
char temp = 'a';
printf("%c\t%d\n",temp,temp);

这句C用C++的cout怎么写???
求教


[解决办法]

C/C++ code
cout<<temp<<"\t"<<(int)temp<<endl;
[解决办法]
cout << temp << "\t" << (int)temp << "\n";
这样就可以了吧
[解决办法]
C/C++ code
#include <iostream>using namespace std;void main(){    char temp = 'a';    printf("%c\t%d\n",temp,temp);    cout<<temp<<"\t"<<static_cast<int>(temp)<<endl;        } 

热点排行