试题1

来源:互联网 发布:魔蝎数据验证码怎么填 编辑:程序博客网 时间:2024/06/05 18:30
//输入一个值打印输出字节void showbits(int parameter){  unsigned char byte,*p =(unsigned char *)¶meter;  int j;  if(p = null){ return;   }  else  for(j=0; j<sizeof(parameter);j++){   byte = *p;   int i;   for(i=0;i<8;i++){if(0x80 & byte) putchar('1');esle putchar('0');byte << =1;   }   p++;  }}


//输出字符串地址值#include <iostream>using std::cout;using std::endl; int main(){    const char *pszStr = "this is a string";         // 输出字符串    cout << "字符串:" << pszStr << endl;                    // 如我们所愿,输出地址值    cout << "字符串起始地址值: " << static_cast<const void *>(pszStr) << endl;     return 0;}


0 0
原创粉丝点击