zoukankan      html  css  js  c++  java
  • 计算机与软件工程第四次作业

    解题过程:第一次接触Python,安装时遇到了许多问题,在网上查阅和浏览博客后,成功安装。
    jieba安装教程https://blog.csdn.net/weixin_42013825/article/details/88562413
    matplotlib安装教程 https://blog.csdn.net/zzx2016zzx/article/details/83099583?depth_1-utm_source=distribute.pc_relevant.none-task-blog-BlogCommendFromBaidu-1&utm_source=distribute.pc_relevant.none-task-blog-BlogCommendFromBaidu-1
    即使在教程的帮助下这个也安装了很久,依次在cmd运行python -m pip install -U pip setuptools和python -m pip install matplotlib语句

    程序代码:

    package come.bean;
    import java.io.*;
    public class ComeBean {
    public static int count(String filename,String target)throws FileNotFoundException,IOException{
    FileReader fr=new FileReader(filename);
    BufferedReader br=new BufferedReader(fr);
    StringBuilder strb=new StringBuilder();
    while(true){
    String line=br.readLine();
    if(line==null){
    break;
    }
    strb.append(line);
    }
    String result=strb.toString();
    int count=0;
    int index=0;
    while(true){
    index=result.indexOf(target,index+1);
    if(index>0){
    count++;
    }
    else{
    break;
    }
    }
    br.close();
    return count;
    }
    /**
    * @param args the command line arguments
    */
    public static void main(String[] args)throws FileNotFoundException,IOException {
    // TODO code application logic here
    String a="C:/Users/王雪婷/Desktop/软件工程/红楼梦.txt";

    水浒传代码:

    package javaapplication10;
    import java.io.*;

    public class JavaApplication10 {
    public static int count(String filename,String target)throws FileNotFoundException,IOException{
    FileReader fr=new FileReader(filename);
    BufferedReader br=new BufferedReader(fr);
    StringBuilder strb=new StringBuilder();
    while(true){
    String line=br.readLine();
    if(line==null){
    break;
    }
    strb.append(line);
    }
    String result=strb.toString();
    int count=0;
    int index=0;
    while(true){
    index=result.indexOf(target,index+1);
    if(index>0){
    count++;
    }
    else{
    break;
    }
    }
    br.close();
    return count;
    }
    /**
    * @param args the command line arguments
    */
    public static void main(String[] args)throws FileNotFoundException,IOException {
    // TODO code application logic here
    String a="C:/Users/Desktop/软件工程/

    由于调试一直出错,所以运行未成功。

  • 相关阅读:
    S2T40,第五章
    S2T40,第四章,简答5
    sqlmap扫描发现注入点示例
    使用jenkins部署.net项目
    在线预览PDF插件
    Visual Studio 2019 License Key
    asp.net core mvc 中 ModelState.IsValid 值是fasle
    sql操作
    sql server 查找与替换 正则表达式 匹配
    asp.net redis 帮助类封装
  • 原文地址:https://www.cnblogs.com/kaka123456/p/12637774.html
Copyright © 2011-2022 走看看