-
-
[旧帖]
[讨论]哈哈 大家觉得这样异或怎么样
0.00雪花
-
发表于:
2010-10-2 22:07
1240
-
[旧帖] [讨论]哈哈 大家觉得这样异或怎么样
0.00雪花
#include <iostream>
#include <ctime>
#include <cstdlib>
#include <assert.h>
const int M=100;
class somes{
private:
inline int randnum()
{
return rand()%99999+1;
}
inline void randnumInit()
{
srand((unsigned int)time(0));
}
char* Conversion(char* s1,char* s2,int n);
char Mi[M];
public:
somes(char* s);
~somes()
{}
inline char* returnMi()
{
//std::cout << "Mi:len " << strlen(Mi) << std::endl;
//std::cout << "Mi:sizeof " << sizeof(Mi) << std::endl;
return Mi;
}
};
somes::somes(char* s)
{
memset(Mi,0,sizeof(char)*M);
randnumInit();
assert(Conversion(Mi,s,randnum()));
}
char* somes::Conversion(char *s1, char *s2, int n)
{
int i=0;
while (*s2!='\0')
{
s1[i]=*s2^n;
++i;
++s2;
}
s1[i]='\0';
return s1;
}
[注意]传递专业知识、拓宽行业人脉——看雪讲师团队等你加入!