20140320 roc曲线 sizeof

1、roc曲线 http://www.zhizhihu.com/html/y2012/4076.html

2、using namespace std的缺点:程序中定义一个变量cout会被误认为是std::cout

3、cout<<left<<setw(5)<<"abc"<<endl;  使用setw必须包含#include<iomanip>

4、sizeof()计算变量在栈中分配的大小

  char q1[]="123"和char q2[]={'1','2','3'}区别

  sizeof(q1)=4;sizeof(q2)=3

     char *str1=(char *)malloc(100); 

  sizeof(str1)=4;

  

#include<iostream>
#include<stdio.h>
#include<string.h>
using namespace std;
struct  
{
    short a1;
    short a2;
    short a3;
}A;
struct
{
    long a1;
    short a2;
}B;

int main()
{
    char *ss1="0123456789";   //4
    char ss2[]="0123456789";//11
    char ss3[100]="0123456789";//100
    int ss4[100];//400
    char q1[]="abc";//4
    char q2[]="a\n";//3
    char *q3="a\n";//4
    char q4[]={'1','2','3'};
    char *str1=(char *)malloc(100);
    void *str2=(void *)malloc(100);
    cout<<sizeof(ss1)<<endl;
    cout<<sizeof(ss2)<<endl;
    cout<<sizeof(ss3)<<endl;
    cout<<sizeof(ss4)<<endl;
    cout<<sizeof(q1)<<endl;
    cout<<sizeof(q2)<<endl;
    cout<<sizeof(q3)<<endl;    
    cout<<sizeof(q4)<<endl;
    cout<<sizeof(A)<<endl;
    cout<<sizeof(B)<<endl;
    cout<<sizeof(str1)<<endl;
    cout<<sizeof(str2)<<endl;

    return 0;
}

 

 

 

 

 

 

posted @ 2014-03-20 14:04  yexuannan  阅读(156)  评论(0编辑  收藏  举报