当前位置:网站首页>Programming training
Programming training
2022-04-23 06:19:00 【#self-discipline#】
There is a polynomial calculator , Huffman codec , The programming of campus tour guide consultation has been uploaded
c Some basic knowledge of language use
1. file
(1)fopen(" route ”," Open mode ”): Open the file to operate on it ; There are several ways to open it r( Open as read-only , The file must exist )r+(r Upgraded version , You can not only read but also write , Be careful r Return first pointer , If the pointer position is not adjusted during the write operation, the original content will be overwritten ; Files still need to exist )w( Open in write only mode , If the file does not exist, it will create a file by itself )w+( Create files in a readable and writable manner , Note that the contents of the file will be emptied and rewritten )a( Open in write only mode , Return end pointer , This allows you to write data after the text data )a+(a Upgrade version of , You can read ); stay ab,wb,rb Is to operate on the binary representation of the file ;
(2)fclose(fp): Close the file after opening it , Increase the running speed ;
(3)fgetc(fp): Read operation , Read fp One character of the position indicated and returns the value , Note that only one character ;
(4)fputc(ch,fp): Write operation , Write a character to fp The position indicated ;
(5)fgets(str,n,fp): Read operation , Read fp After the position n Characters to character array str[] in ;( The last character is set as the cut-off signal \0, So take n You have to set n+1);
(6)fputs(str,fp): take str( Array name ) String input to file fp After the position ,str It can also be directly changed to “ character string ”;
(7)fscanf(fp,"%d%c%s",&a,&b,str): Read operations , take fp After that, the content satisfying the format is assigned to a,b,str;fgets,fgetc Hodgepodge type ;
(8)fprintf(fp,"%d%c%s",a,b,c): Write operation , This kind of writing is very convenient , Input all types of quantities into the file ,fgetc And fgets Hodgepodge type ;
(9)rewind(fp): Put the pointer fp Relocate to the head of the file ;
(10)fwrite(buffer,size,n,fp): It means output n individual size size buffer The data indicated by the pointer to fp After the position ;
(11)fread(buffer,size,n,fp): It means to read fp After n individual size The size of the data to buffer;
(13)fseek(fp, size, a):a=0 Put the file pointer fp Move to the first starting number size Size position ;a=1, Count from the pointer position ;a=2, At the end of the text ;
2. character string
(1)int strcmp(const char *s1, const char *s2): Compare s1,s2, If equal, return 0; if s1>s2 Return greater than 0 Number of numbers ; if s1<s2 Then return less than 0 A number of ;
(2)strcpy(s1,s2): take s2 Copied to the s1;
(3)strcat(s1,s2): take s2 Connect to s1 At the end of ;
/int scanf(char *format[,argument,...]);
double pow(double x,double y)// Find exponential power x Of y The next power
fscanf Read space
feof()
%[^\r\n]
Solve Chinese reading garbled code
Programming :
Need to achieve the function :
(1) Univariate sparse polynomial calculator (2) Maze problem (3) Keyword search (4) Huffman code / / Decoder (5) Campus tour guide consultation
Menu functions :
First class menu : Show the options , Enter the number and compare it to the corresponding secondary menu ;
Two level menu :(1)
(1) Unary sparse polynomial function :
Realization function :① Input univariate sparse polynomial single linked list format ② Realize polynomial addition and subtraction function ③ Realize binomial multiplication , Construct a single linked list for each element of the first single linked list multiplied by all elements of the second single linked list. These single linked lists do not form an array ;
You need a function :
void CreatPolyn (LinkList &P, int m );
void DestroyPolyn (LinkList &P );
void PrintPolyn (LinkList P );
void AddPolyn (LinkList &Pa, LinkList &Pb );
void SubtractPolyn (LinkList &Pa, LinkList &Pb );
void MultiplyPolyn (LinkList &Pa, LinkList &Pb );
(4) Huffman code / Decoder :
Realization function :① Edit text (1 Rewrite text 2 Add characters to the text )② Statistics text character frequency ③ Build a Huffman tree ④ Encode a paragraph of text ⑤ For a binary decoding ;
void count(LinkList2 &L1);// Store the statistical character frequency into L1 In the table ;
(5) Campus tour guide consultation
Realization function :① Read the campus guide map information from the file ( Output information )② Modify the extended function : Open the file and modify it yourself ③ Inquire about any scenic spot ( Enter the attraction number ④ The shortest path of any two vertices
--
版权声明
本文为[#self-discipline#]所创,转载请带上原文链接,感谢
https://yzsam.com/2022/04/202204230544083255.html
边栏推荐
- 2. Average length of words
- Code neat way to learn
- How does MySQL convert stored seconds into dates
- Exception handling: grab and throw model
- 在Jupyter notebook中用matplotlib.pyplot出现服务器挂掉、崩溃的问题
- PHP processing JSON_ Decode() parses JSON stringify
- SQL optimization best practices
- Font shape `OMX/cmex/m/n‘ in size <10.53937> not available (Font) size <10.95> substituted.
- 線性代數第一章-行列式
- Chapter 3 of linear algebra - Elementary Transformation of matrix and system of linear equations
猜你喜欢

数字图像处理基础(冈萨雷斯)二:灰度变换与空间滤波

Anaconda安装PyQt5 和 pyqt5-tools后没有出现designer.exe的问题解决

Font shape `OMX/cmex/m/n‘ in size <10.53937> not available (Font) size <10.95> substituted.

Fundamentals of digital image processing (Gonzalez) II: gray transformation and spatial filtering

Paper on LDCT image reconstruction: edge enhancement based transformer for medical image denoising
![去噪论文阅读——[CVPR2022]Blind2Unblind: Self-Supervised Image Denoising with Visible Blind Spots](/img/fd/84df62c88fe90a73294886642036a0.png)
去噪论文阅读——[CVPR2022]Blind2Unblind: Self-Supervised Image Denoising with Visible Blind Spots

Generate excel template (drop-down selection, multi-level linkage)
![无监督去噪——[TMI2022]ISCL: Interdependent Self-Cooperative Learning for Unpaired Image Denoising](/img/cd/10793445e6867eeee613b6ba4b85cf.png)
无监督去噪——[TMI2022]ISCL: Interdependent Self-Cooperative Learning for Unpaired Image Denoising

container

Illustrate the significance of hashcode
随机推荐
Pyemd installation and simple use
[transfer] MySQL: how many rows of data can InnoDB store in a B + tree?
Kingdee EAS "general ledger" system calls "de posting" button
数字图像处理基础(冈萨雷斯)二:灰度变换与空间滤波
去噪论文——[Noise2Void,CVPR19]Noise2Void-Learning Denoising from Single Noisy Images
Supply chain service terms
Fundamentals of digital image processing (Gonzalez) I
Pytorch——数据加载和处理
The bottom implementation principle of thread - static agent mode
Filebrowser realizes private network disk
CONDA virtual environment management (create, delete, clone, rename, export and import)
lambda expressions
4. Print form
JDBC connection database
Fundamentals of digital image processing (Gonzalez) II: gray transformation and spatial filtering
Write your own redistemplate
The problem that the page will refresh automatically after clicking the submit button on the form is solved
10.Advance Next Round
Automatic control (Han min version)
Contrôle automatique (version Han min)