社区讨论
用C++写的exe与txt互转代码,有bug求调
灌水区参与者 8已保存回复 37
讨论操作
快速查看讨论及其快照的属性,并进行相关操作。
- 当前回复
- 37 条
- 当前快照
- 1 份
- 快照标识符
- @m67a8uh3
- 此快照首次捕获于
- 2025/01/22 10:26 去年
- 此快照最后确认于
- 2025/11/05 01:17 4 个月前
编码
CPP#include<bits/stdc++.h>
using namespace std;
int s[10000001],t=1;
int main()
{
freopen("编码exe","rb",stdin);
freopen("out.txt","w",stdout);
char a;
a=getchar();
while (a!=EOF)
{
s[t]=(int)a;
t++;
a=getchar();
}
cout<<t-1<<"\n";
for (int i=1;i<=t-1;i++)
{
cout<<s[i]<<" ";
}
return 0;
}
解码
CPP#include<bits/stdc++.h>
using namespace std;
int t;
int main()
{
freopen("out.txt","r",stdin);
freopen("解码exe","wb",stdout);
cin>>t;
for (int i=1;i<=t;i++)
{
int a;
cin>>a;
cout<<(char)a;
}
return 0;
}
悬2关
回复
共 37 条回复,欢迎继续交流。
正在加载回复...