栏目分类:
子分类:
返回
名师互学网用户登录
快速导航关闭
当前搜索
当前分类
子分类
实用工具
热门搜索
名师互学网 > IT > 软件开发 > 后端开发 > Python

EE308

Python 更新时间: 发布时间: IT归档 最新发布 模块sitemap 名妆网 法律咨询 聚返吧 英语巴士网 伯小乐 网商动力

EE308

The link Your Classhttps://bbs.csdn.net/forums/MUEE308FZ?category=0
The link of Requirement of This Assignmenthttps://bbs.csdn.net/topics/600798588
The Aim of This Assignment1. To achieve a program function 2. Extract keywords of different levels from the C++ code files that are read in 3. learn the use of github
MU STU ID and FZU STU ID19103921_831902217
✔Content

文章目录
        • ✔**Content**
        • **The links**
        • **PSP FORM**
        • **Description of problem-solving ideas**
        • **The Chart of the Key Functions**
      • **Code Description**
        • **The entire code**
        • **Summarize this assignment**

The links

https://github.com/yyx0115/EE308_LAB2/tree/main

PSP FORM
Personal Software Process stageEstimated Time(min)Actual Time(min)
Planning
Estimate3030
Development
Analysis100120
Design Spec60100
Design Review1515
Coding Standard3030
Design180200
Coding12001600
Code Review6060
Test100100
Reporting
Test Report3030
Size Measurement1515
Postmortem & Process Improvement Plan6060
Sum of Time18802360
Description of problem-solving ideas
  1. Choose Language
  • c++/c
  • Python
  • java
  1. Review the knowledge of C/C++
    we need to know the keywords:

After last semester’s study, I acquired some knowledge about Java, C ++/ C. It’s a pity that I didn’t learn Python yet. After a summer vacation of “indulgence”, before starting this assignment, I need to review the “if-else” knowledge to wake up my memory

  1. rough thinking
  • The file is read in the specified address

  • Create a user input class

  • a search class to find the keywords

  • a class to calculate the number of keywords and the times of switches and cases

  • use pointer function probably

  • the number of if-else and if else if else

The Chart of the Key Functions Code Description
  1. create a file named “in.txt” include⤵:
#include 
int main(){
    int i=1;
    double j=0;
    long f;
    switch(i){
        case 0:
            break;
        case 1:
            break;
        case 2:
            break;
        default:
            break;
    }
    switch(i){
        case 0:
            break;
        case 1:
            break;
        default:
            break;
    }
    if(i<0){
        if(i<-1){}
        else{}
    }
    else if(i>0){
        if (i>2){}
        else if (i==2) {}
        else if (i>1) {}
        else {}
    }
    else{
        if(j!=0){}
        else{}
    }
    return 0;
}
  1. The input⤵:

    #include
    using namespace std;
    map mp;
    string words[32]={"auto","case","char","const","do",
    		   "double","enum","extern","float","goto",
    		   "int","long","register","short","signed","static",
    		   "struct","typedef","union","unsigned","void","volatile","while"
    		   ,"break","continue","for","if","sizeof","switch","return","default","else"};
    
  2. open and read the file⤵:

void getNum(char *s,int grade){
	queue q;
	ifstream infile;
	infile.open(s,ios::in);
	if (!infile){
		printf("file opened failure!!!");
		return ; 
	}
  1. To find the switch and case numbers⤵:
	string temp;
	bool judgeswitch=false;
	int cntcase;
	while (!infile.eof()){
		infile>>temp;
		//cout< 
  1. output and the main function⤵:
int total=0;
	for (auto v:mp){
		//output all the keywords
		//cout<>url>>grade;
	getNum(url,grade);
	return 0;
}
  1. The output⤵

The entire code
#include
using namespace std;
map mp;
string words[32]={"auto","case","char","const","do",
		   "double","enum","extern","float","goto",
		   "int","long","register","short","signed","static",
		   "struct","typedef","union","unsigned","void","volatile","while"
		   ,"break","continue","for","if","sizeof","switch","return","default","else"};

void getNum(char *s,int grade){
	queue q;
	ifstream infile;
	infile.open(s,ios::in);
	if (!infile){
		printf("file opened failure!!!");
		return ; 
	}
	string temp;
	bool judgeswitch=false;
	int cntcase;
	while (!infile.eof()){
		infile>>temp;
		//cout<>url>>grade;
	getNum(url,grade);
	return 0;
}

Summarize this assignment
  • I gained new knowledge on how to use GitHub,created my own GitHub page. ♪(´▽`)

  • wrote code in the process of consolidating and reviewing the previous courses. After relearning, I found many deficiencies and did not grasp many details in place. ( •̀ ω •́ )y

  • Learned how to draw a flow chart with markdown and plan in advance with PSP form, which greatly improved the efficiency

  • I feel very guilty for not completing the last two levels of questions, and my ability still needs to be improved. `(>﹏<)′

  • The knowledge points of file flow need to be further strengthened. The reason why we choose to use C + + is that the knowledge of Java is not proficient enough and needs to be further study.

转载请注明:文章转载自 www.mshxw.com
本文地址:https://www.mshxw.com/it/269249.html
我们一直用心在做
关于我们 文章归档 网站地图 联系我们

版权所有 (c)2021-2022 MSHXW.COM

ICP备案号:晋ICP备2021003244-6号