mycp 补交作业
2024-08-29 08:58:27
老师好:我昨天做完时已经是11点多了,错过了提交时间,希望用此篇博客弥补一下我的过失。
import java.io.;
import java.lang.;
import java.util.Scanner;
public class MyCP {
public static void main(String args[]) {
try {
FileReader file=new FileReader("/Users/windows/Desktop/mycp.txt");
OutputStreamWriter binary=new OutputStreamWriter(new FileOutputStream("/Users/windows/Desktop/mycp.txt"));
BufferedReader br=new BufferedReader(file);
String strs=null;
while ((strs=br.readLine())!=null) {
System.out.println(strs);
int num=Integer.parseInt(strs);
//for (int i=0;i<strs.length();i++){
binary.write(Integer.toBinaryString(num));
System.out.print(Integer.toBinaryString(num));
//}
}
binary.close();
} catch (FileNotFoundException e) {
System.out.println(" NO file exist");
} catch (IOException e) {
e.printStackTrace();
}
System.out.println();
try {
FileReader file2=new FileReader("C:\Users\lenovo\zhuanyedajiesanshinian20155307\zhuanyedajiesanshinian20155307");
OutputStreamWriter test=new OutputStreamWriter(new FileOutputStream("C:\\Users\\LJY\\IdeaProjects\\Stream\\src\\test2.txt"));
BufferedReader br2=new BufferedReader(file2);
String strs2=null;
while ((strs2=br2.readLine())!=null) {
System.out.println(strs2);
//int num2=Integer.parseInt(strs2);
//for (int i=0;i<strs.length();i++){
test.write(Integer.parseInt(strs2,2));
System.out.println(Integer.parseInt(strs2,2));
//}
}
test.close();
} catch (FileNotFoundException e) {
System.out.println("file doesn't exist");
} catch (IOException e) {
e.printStackTrace();
}
}
}
mycp码云链接
最新文章
- 浅谈SQL注入风险 - 一个Login拿下Server
- httphandler和httpmodule的区别
- Linux基础-目录结构
- windows里面的批处理命令不停地处理同一条命令
- PYTHON FABRIC实现远程操作和部署
- Quartus13.0破解方法
- FreeBSD 路由详解
- java常见内存溢出(OOM)
- 分页技术之GridView控件
- 一个跨域请求的XSS漏洞
- 【Cocos2d-X游戏实战开发】捕鱼达人之开发前准备工作(一)
- Linux软件安装管理 - CentOS (二)
- asp.net core 编译mvc,routing,security源代码进行本地调试
- WinForm中ClickOnce发布至广域网
- hadoop配置遇到问题的解决
- Android开发 ViewConfiguration 用法
- mysql把查询结果集插入到表理
- 附006.harbor.cfg配置文件详解
- 基于spec互评Alpha版本
- 修改Tomcat的网页端口和指向路径