//为什么此VC++编译通不过,而支持标准的Dec-C++和Quincy都可以编译通过!!
/////////首先申明我是菜鸟!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
///////关于VC++的问题,也许是我的理解错误。。
//
/*  #include<iostream>using namespace std;int main()
{
char hexnum[8];
char temp[8];
  cin>>hexnum;
 temp = hexnum;  //error C2106: '=' : left operand must be l-value 
                 //VC++编译通不过
     //支持标准的Dec-C++ 和 Quincy 都可以编译通过!!!!!!
 //为什么???????????????????????????????????????????????????/
        //hexnum和temp都是静态初始化的变量
                 //当然用 strcpy(temp,hexnum); 可以               
 cout<<temp;
 return 0;       //也许我既然用#include<iostream>
                 //            using namespace std;
}                //就不该用char,而用string,vector之类
*////////
//下面是一段把16进制转换为10进制的小程序。(如有错误和不妥请狂改!!!)
//疑惑是这样出来的:....................................
//请高手赐教
////////////////////////////////////////////////////////////////////////////
#include<iostream>
#include<string>
#include<cmath>
using namespace std;int main(   )
{
    double hex[8];
double  dec=0;
char hexnum[8];
int numsize,tempszie; cout<<"Enter 8 bit Hexadecimal :   ";
                      //cout一个16进制数
cin>>hexnum; numsize = strlen(hexnum);
tempszie = 8 - numsize;
    /////////////////////////////////////////////////////
char temp[8];
//for(int ct=0;ct<8;++ct)    //如果这样没错
    //temp[ct] = hexnum[ct];
      temp = hexnum;            //也许是VC的错!!!!!!!!!!!!???????/
                                //????
//请高手赐教????
if( numsize<8 )
{       int m=0;

for(int n=0; n<8; ++n)
{
            if( n < tempszie )
  {  hexnum[n] = 48;  }  //我设定的是8位,
      //把if(!8)转换为8位
            else
{      hexnum[n] = temp[m];  
                     m++;
}
                   
} }
//cout<<"The 8 bit number is :  "<<hexnum<<endl;
for(int i=0;i<8;++i)
{
               
if( hexnum[i]<=57 && hexnum[i]>=48 )
{

hex[i]=(hexnum[i]-48);

dec+=( hex[i]*pow(16,7-i) );
}
else if( hexnum[i]<=70 && hexnum[i]>=65 )
{

hex[i]=(hexnum[i]-55);

dec+=( hex[i]*pow(16,7-i) );
}
else
{

hex[i]=(hexnum[i]-87);

dec+=( hex[i]*pow(16,7-i) );
} }
cout<<"The number Decimalist is :  "<<dec<<endl;
  
  system("PAUSE");
  return 0;
}