入门级C++问题
char temp = 'a';
printf("%c\t%d\n",temp,temp);
这句C用C++的cout怎么写???
求教
[解决办法]
cout<<temp<<"\t"<<(int)temp<<endl;
[解决办法]
cout << temp << "\t" << (int)temp << "\n";
这样就可以了吧
[解决办法]
#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; }