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/软件工程/

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

  • 相关阅读:
    typescript-泛型-类型检查
    typescript-class-interface
    typescript-类class
    typescript-接口interface
    Oracle 密码过期
    VMware Redhat虚拟机扩容硬盘
    华硕 U系列电脑拆后盖注意事项
    VS + QT 出现 LNK2001 无法解析的外部符号 QMetaObject 的问题
    c++ _pFirstBlock == pHead
    c++ 套路多
  • 原文地址:https://www.cnblogs.com/kaka123456/p/12637774.html
Copyright © 2011-2022 走看看