C++ c+;中打印的MLT应用程序值错误+;
这是我的程序的main():- 只是试着调试一下C++ c+;中打印的MLT应用程序值错误+;,c++,C++,这是我的程序的main():- 只是试着调试一下 int main() { cout<<"in main()"; int i,x; while(nr!=128 && nr!=192 && nr!=256) { //cout<<"Enter the lenghth of the key(128,192 or 256 only) : "; //cin>>nr;
int main()
{
cout<<"in main()";
int i,x;
while(nr!=128 && nr!=192 && nr!=256)
{
//cout<<"Enter the lenghth of the key(128,192 or 256 only) : ";
//cin>>nr;
nr=128;
}
cout<<"after while when the value of nr is : "<<nr;
nk = nr / 32;
nr = nk + 6;
cout<<endl<<"now the value of nr = "<<nr<<" and nk = "<<nk;
int ascii_table[26]={
0x61,
0x62,
0x63,
0x64,
0x65,
0x66,
0x67,
0x68,
0x69,
0x6A,
0x6B,
0x6C,
0x6D,
0x6E,
0x6F,
0x70,
0x71,
0x72,
0x73,
0x74,
0x75,
0x76,
0x77,
0x78,
0x79,
0x7A
};
string characters="abcdefghijklmnopqrstuvwxyz";
// string bla="0x";
cout<<"Enter plain text :";
string str="disha";
char msg[32];
// string message[32];
//cin>>str;
cout<<str;
for(int i=0;i<str.length();i++){
int find=0;
while(1){
if(str[i]==characters[find])break;
find++;
}
msg[i]=ascii_table[find];
}
for(int i=0;i<str.length();i++)
{int h=msg[i];
cout<<std::hex<<h<<"\t";}
char temp[32] = {0x00 ,0x01 ,0x02 ,0x03 ,0x04 ,0x05 ,0x06 ,0x07 ,0x08 ,0x09 ,0x0a ,0x0b ,0x0c ,0x0d ,0x0e ,0x0f};
cout<<endl;
x=nk*4;
cout<<"before for loop nk = "<<nk<<" and nk*4 = "<<x;
/*for(i=0;i<x;i++)
{
cout<<" inside for loop ";
Key[i]=temp[i];
in[i]=msg[i];
cout<<in[i]<<'\t';
}
(cout<<endl<<"after for loop";
KeyExpansion();
// The next function call encrypts the PlainText with the Key using AES algorithm.
Cipher();
cout<<"\nText after encryption:\n";
for(i=0;i<nb*4;i++)
{
cout<<out[i];
}
cout<<endl;*/
return 0;
}
intmain()
{
coutcoutcout值以十六进制显示,因为您使用了cout值以十六进制显示,因为您使用了cout我认为它正在打印十六进制值0x10是16进制10。此代码的格式非常糟糕。请您进行排序,好吗?您还应该删除不相关的命令删除部分;我不明白为什么我们需要在问题中包含它们。我认为它正在打印十六进制值0x10是16进制10。这段代码的格式非常糟糕。请你把它整理一下好吗?你还应该删除不相关的注释部分;我不明白为什么我们需要在问题中包含它们。
cout<<std::hex<<h<<"\t";