EE308 Lab1-2
The Link Your Class | https://bbs.csdn.net/forums/MUEE308FZU202201?category=0&typeId=519086 |
---|---|
The Link of Requirement of This Assignment | https://bbs.csdn.net/topics/608734907 |
The Aim of This Assignment | learn how to use github&writing code |
MU STU ID and FZU STU ID | 20124104_832001205 |
GitHub repository
https://github.com/xxxxxxqiu/demo
Directory
PSP
Personal Software Process Stages | Estimated Time/minutes | Completed Time/minutes |
---|---|---|
Planning | 60 | 60 |
Estimate | 2740 | 4200 |
Development | 720 | 540 |
Analysis | 360 | 1440 |
Design Spec | 30 | 60 |
Design Review | 30 | 60 |
Coding Standard | 20 | 30 |
Design | 120 | 200 |
Coding | 720 | 540 |
Code Review Planning | 360 | 720 |
Test | 80 | 160 |
Reporting | 100 | 180 |
Test Report | 60 | 80 |
Size Measurement | 20 | 30 |
Postmortem&Process Improvement | 60 | 100 |
total | 2740 | 4200 |
Problem-solving ideas
Create a github account
- Tip:Log in github by connecting your computer to your mobile hotspot. Do not use campus wifi.
- Create an account on github
https://github.com/
Download Git Bash and Initialize
- how to download git bash
- Initialize
- Tip: Use local disk (E:) to operate. When I perform the command “git push” on disk (D:) , the repository name and branch name are correct but the operation fails. However, disk (E:) is feasible.
- set user
In the git bash command box, input:
git config --global user.name “Your Name”
git config --global user.email “email@example.com” - Perform the following operations in an empty local file:
Create repository
- Simply name the repository and select public to create it
Establish a connection between repository and the local warehouse
- how to make a connection
- Using SSH Connection
Input the command:$ git remote add + name of repository + add
add is 👇
Writing code
-------------------------------------------just write------------------------------------------
Use github for version control
- Put the code file inside the initialized file
- input command:
- input command:git commit -m “what you want to note”
- then:
- now you can see the change in your github.com
Design&Implementation
Key code modules
int main() {
string s1 = "abcjkkjkjjdef";
string s2 = "de";
int ans = s1.find(s2,3);//从S1的第二个字符开始查找子串S2
cout << ans << endl;//find():输出为s2在s1中出现的位置
return 0;
}
int correspond( char le ) //是否为字母
{
if( ( le >= 'a' && le <= 'z' ) || ( le >= 'A' && le <= 'Z' ) )
return 1;
else
return 0;
}
int judge( string s1 , string s2 ) //函数:判断s1中是否有s2,若有,则返回1
{
int w( char str ); //
int pos = s1.find( s2 , 0 ); //找b在a中出现的位置
int len = s2.length(); //len为b长度
if( pos != string::npos ) //若a里找得到b
{
if( pos == 0 ) //出现位置为0
{
if(w( s1[ pos + len ] ) == 0 )//最后一个字符+1为空
return 1; //返回1
else
return 0; //
}
else //出现为其他位置
{
if(w( s1[ pos + len] ) == 0 && w( s1[ pos - 1] ) == 0 ) // b前后都为空
return 1;
else
return 0;
}
}
return 0;
}
Test
- The first time I tried to write a program that counted the total number of keywords. However, since only whitespace is taken into account, the total is the number of whitespace separated strings in a cpp file.
- correct:
Summarize
In this experiment, I learned github and how to use github for version control. Also, I reviewed the knowledge of c++.