第二次寒假作业总结二

主要代码解析

/*ip转化*/
for (int i = 7; i >= 0; i--) {
zw1[i] = num1[len] % 2;
num1[len] /= 2;
}
for (int i = 15; i >= 8; i--) {
zw1[i] = num2[len] % 2;
num2[len] /= 2;
}
for (int i = 23; i >= 16; i--) {
zw1[i] = num3[len] % 2;
num3[len] /= 2;
}
for (int i = 31; i >= 24; i--) {
zw1[i] = num4[len] % 2;
num4[len] /= 2;
}
//网址转化
for (int i = 0; i < num5[len]; i++) {
zw2[i] = 1;
}
for (int i = 0; i <= 31; i++) {
zw3[i] = zw1[i] & zw2[i];
zw4[i] = zw3[i];
}
for (int i = num5[len]; i < 32; i++) {
zw4[i] = 1;
}

//重新赋值
int ss = 0, sss = 128;
for (int i = ss; i <= ss + 7; i++) {
num1[len] += zw3[i] * sss;
sss /= 2;
}
ss += 8;
sss = 128;
for (int i = ss; i <= ss + 7; i++) {
num2[len] += zw3[i] * sss;
sss /= 2;
}
ss += 8;
sss = 128;
for (int i = ss; i <= ss + 7; i++) {
num3[len] += zw3[i] * sss;
sss /= 2;
}
ss += 8;
sss = 128;
for (int i = ss; i <= ss + 7; i++) {
num4[len] += zw3[i] * sss;
sss /= 2;
}
ip1[len] = 16777216 * num1[len] + 65536 * num2[len] + 256 * num3[len] + num4[len];


switch (ds1[len]) {
case 'A':
dp1[len] = ds1[len] - 55;
break;
case 'B':
dp1[len] = ds1[len] - 55;
break;
case 'C':
dp1[len] = ds1[len] - 55;
break;
case 'D':
dp1[len] = ds1[len] - 55;
break;
case 'E':
dp1[len] = ds1[len] - 55;
break;
case 'F':
dp1[len] = ds1[len] - 55;
break;
default:
dp1[len] = ds1[len] - 48;
}



#include <iostream>
#include <fstream>
using namespace std;

int main() {
int a[10001], b[10001];
int len = 0;
ifstream file("ans1.txt");
while ( ! file.eof() ) {
file >> a[len];
len++;
}
len = 0;
ifstream fil("output.txt");
while ( ! fil.eof() ) {
fil >> b[len];
len++;
}
int flag = 0;
len --;
for (int i = 0; i < len; i++) {
if (a[i] != b[i]) {
flag++;
cout << i << "\n";
}
}
cout << flag ;
return 0;
}



需要解决的问题，最大问题就是需求没弄懂

1.模块化问题

2.代码量问题

3./main文件名的问题

posted @ 2022-01-26 00:33  帝芬尼  阅读(74)  评论(0编辑  收藏  举报