Data structure/C + + programming job generation, C + + processing English homework

Source: Internet
Author: User
Tags ticket

Data structure/C + + programming job generation, C + + processing English homework
1. Course Design Topics
Select one of the following two topics to complete.
1.1 University Examination Registration system
University Examination registration to the educational Administration department increased a lot of work, registration data manual entry is time-consuming and inevitable errors, but also to many students to exploit. This project is a simple simulation of the management of exam registration, using the menu to select the way to complete the following functions:
(1) Input candidate information, each candidate information from the ticket number (five digits), name, gender, age, and other information composition of the subject;
(2) output candidate information;
(3) Check the information of candidates;
(4) adding candidate information;
(5) Revise the candidate information;
(6) Delete candidate information;
(7) The examination information is sorted according to the ticket number.
Requirements: Friendly interface, each step to give the appropriate operating instructions, and the system has a certain degree of fault-tolerant ability.
1.2 Beijing Attractions Enquiry System
In tourist attractions, visitors are often asked to inquire about the shortest route from one attraction to another and the shortest distance, such tourists do not like to follow the guide map of the route to visit, but to choose their own interesting attractions to explore. In order to help this kind of tourist information query, we need to calculate the shortest path and shortest distance between all attractions. The establishment of Beijing Scenic Tourism Information Management system, the main functions of the implementation include the development of tourist attractions guide Route strategy and the development of scenic road laying strategy. The following functional modules are implemented:
(1) Create scenic spots distribution map, requires at least 10 spots in the distribution map;
(2) Output scenic spots distribution map, expressed by adjacency matrix;
(3) Output the guide route map from a certain point;
(4) Judging the tour guide Route map has no circuit;
(5) Find the shortest path and shortest distance between two attractions;
(6) Output road construction planning diagram.
Request the main program with menu options for the user to select the function module, friendly interface, each step to give appropriate operating instructions, the system has a certain degree of fault-tolerant ability.

2. Curriculum Design Report Writing specification
The course design report includes the requirement analysis, summary design, detailed design, program test, impressions and experience of the topic. The following is an example of how to write a course design report using the sparse matrix operator.

Title: Design a sparse matrix calculator to realize the addition, subtraction, multiplication of two sparse matrices, and the transpose operation of matrices. Using the menu as the application interface, the user chooses the menu to realize the addition, subtraction, multiplication and matrix speed calculation of the matrix respectively.
2.1 Demand Analysis
1. A sparse matrix is a matrix with a sparse factor of less than or equal to 0.5. Using "sparse" features for storage and computing can greatly save storage space and improve computational efficiency. Implement an operator that can perform basic operations on sparse matrices.
2. The ternary sequential table with "logically linked information" represents the sparse matrix, which realizes the Matrix transpose and the operation of the addition, subtraction and multiplication of two matrices. The input form of sparse matrix is represented by ternary group, and the results are listed in array form.
3. The demo program is conducted as a dialog between the user and the computer, and the array is established as an edge input edge. First, the number of rows and columns of the matrix is entered, and the number of row and column of the two matrices given is matched to the required operation.
4. The program can not restrict the input properties of ternary groups, and the Order of the ternary group is inserted into the matrix, so that no error is generated when the operation is performed.
5. When a ternary group is used to represent a sparse matrix, the resulting matrix of addition, subtraction, and multiplication is generated separately.
6. Operating environment: vc6.0++.
2.2 Overview Design
The sparse matrix element is represented by a ternary group:
typedef struct{
int i;//non-0-dollar row subscript
int j;//non-0-dollar column subscript
int e;//Matrix not 0 yuan
}triple;
Sparse matrices are stored in ternary sequential tables:
#define Msxsize 12500//assumes a maximum value of 200 for a non-0-tuple number
#define MAXRC 10//Assuming that the maximum number of rows for a matrix is 10
typedef struct
{
int mu; Number of rows in the matrix
int nu; Number of columns in the matrix
int tu; Number of non-0 elements of a matrix
Triple data[maxsize+1]; Non-0 Yuan ternary table, data[0] no use
int rpos[maxrc+1]; Position table for the first non-0 element of each row
}tabletype;
The main functions and functions of the system are as follows:
Menu (): Master menu, receive user's option;
Input_matrix (): input matrix;
Print_matrix (): Output matrix;
Cal_matrix (): Calculates the number of bits in the ternary group of the first non-0-dollar matrix per row;
Transposematrix (): Matrix transpose;
Add_matrix (): matrix addition operation;
Sub_matrix (): Matrix subtraction operation;
Multi_matrix (): Matrix multiplication operation.
The module's call Relationship 1 is shown.

Figure 1 Program Call module

2.3 Detailed Design
1. Main function Design

//*****************************************
* Matrix Operation Main Function *
//*****************************************
Main function, the implementation of the User menu menu printing, and according to the user's options to perform the corresponding functions, the main function to be concise and clear.
void Main ()
{
Num=menu ();//Print Main Menu
while (NUM)
{
Switch (NUM)
{
Case 1:
Multi_matrix ();//Matrix multiplication
Break
Case 2:
Transposematrix ();//Matrix Transpose
Break
Case 3:
Add_matrix ();//Matrix addition
Break
Case 4:
Sub_matrix ();//Matrix subtraction
Case 0:
Break
}//switch
Num=menu ();
}//while
}
2. Main Menu Design
The master menu is used to output cue information and process input, and this function returns the user's options, provided to the switch statement in the main function. For non-compliant options, prompt for an error and ask the user to reenter it. Combine this function with the main function to compile and run the program to check and verify that the menu options are correct.
The main menu is as follows:
//*****************************************
* Print Master Menu function *
//*****************************************
int menu ()
{
printf ("\ n Main Menu");
printf ("\n*********************");
printf ("\n1. Matrix multiplication ");
printf ("\n2. Matrix transpose ");
printf ("\n3. Matrix addition ");
printf ("\n4. Matrix subtraction ");
printf ("\n0. Exit ");
printf ("\n*********************");
scanf ("%d", &num);
while (num<0| | NUM&GT;4)//input illegal, re-enter
scanf ("%d", &num);
return num;
}
3. Matrix multiplication Operation function
//*****************************************
* Matrix multiplication Arithmetic *
//*****************************************

Status Multi_matrix ()
{
Input_matrix (&a);//Input matrix A
Input_matrix (&AMP;B); Input Matrix B
Cal_matrix (&a);//calculate matrix A bit ordinal of the first non-$ 0 per line
Cal_matrix (&b);//calculation Matrix B The first non-0-dollar bit sequence number per line
if (A.NU!=B.MU)//does not conform to the matrix multiplication condition, cannot multiply
return ERROR;
C.mu=a.mu; Initialize to Matrix C
c.nu=b.nu;
c.tu=0;
if (a.tu*b.tu!=0) {
for (arow=1;arow<=a.mu;arow++) {/* handles each line of matrix A */
for (p=1;p< maxrc+1;p++)/* Current line element accumulator clear 0 */
ctemp[p]=0;
c.rpos[arow]=c.tu+1;
if (AROW&LT;A.MU)
Tp=a.rpos [arow+1];
Else
Tp=a.tu +1;
for (P=a.rpos[arow]; p<tp;p++) {//To obtain a non-$ 0 for the Crow line in C
BROW=A.DATA[P].J;
if (brow<b.nu)
T=B.RPOS[BROW+1];
Else
t=b.tu+1;
for (q=b.rpos[brow];q<t;q++) {
CCOL=B.DATA[Q].J; /* The column number of the product element in Matrix C */
CTEMP[CCOL]+=A.DATA[P].E*B.DATA[Q].E;
}/*for q*/
}//for P
for (ccol=1;ccol<=c.nu;ccol++)
if (Ctemp[ccol])/* Compress store this row is not 0 yuan */
{
if ((c.tu) >maxsize)
Exit (1);
c.tu++;
C.data[c.tu].i=arow;
C.data[c.tu].j=ccol;
C.data[c.tu].e=ctemp[ccol];
}/*end if*/
}/*for arrow*/
}/*if*/
Print_matrix (a);
Print_matrix (b);
Print_matrix (c);
}
4. Matrix Transpose algorithm
//*****************************************
* Matrix Transpose algorithm *
//*****************************************
void Transposematrix () {
Input_matrix (&a);//Input matrix A
b.mu=a.nu;
B.nu=a.mu;
B.tu=a.tu;
if (b.tu) {
Q=1; /*b.data Subscript */
for (col=1;col<=a.nu;col++)//To each column of a
for (p=1;p<=a.tu;p++)/*p a subscript */
if (A.data[p].j==col) {//Look for a non 0-dollar column in matrix A that is listed as Col
B.DATA[Q].I=A.DATA[P].J;
B.DATA[Q].J=A.DATA[P].I;
B.DATA[Q].E=A.DATA[P].E;
q++;
}//if (P)
}//if (B.TU)
Print_matrix (b); Transpose matrix for output a
}
5. Matrix addition algorithm
//*****************************************
* Matrix addition Operation function *
* C=a+b *
//*****************************************
Status Add_matrix () {
Input_matrix (&a); Input matrix A
Input_matrix (&AMP;B); Input Matrix B
if (A.mu!=b.mu | | A.nu!=b.nu)//Not satisfying matrix addition condition
return ERROR;
C.mu =a.mu;
C.nu =a.nu;
Ta=1;tb=1;tc=1;
if (a.tu *b.tu!=0) {
while ((TA&LT;=A.TU) && (tb<=b.tu)) {
if (a.data[ta].i==b.data[tb].i) {
if (A.DATA[TA].J==B.DATA[TB].J) {
TEMP=A.DATA[TA].E+B.DATA[TB].E;
if (temp!=0) {
C.DATA[TC].I=A.DATA[TA].I;
C.DATA[TC].J=A.DATA[TA].J;
C.data[tc].e=temp;
tc++;
}//end if (temp)
ta++;tb++;
}//end if
else{
if (A.DATA[TA].J&LT;B.DATA[TB].J) {
C.DATA[TC].I=A.DATA[TA].I;
C.DATA[TC].J=A.DATA[TA].J;
C.DATA[TC].E=A.DATA[TA].E;
ta++;tc++;
}//end of Else if
else{
C.DATA[TC].I=B.DATA[TB].I;
C.DATA[TC].J=B.DATA[TB].J;
C.DATA[TC].E=B.DATA[TB].E;
tb++;tc++;
}//
}
}//end if
else{
if (a.data[ta].i<b.data[tb].i) {
C.DATA[TC].I=A.DATA[TA].I;
C.DATA[TC].J=A.DATA[TA].J;
C.DATA[TC].E=A.DATA[TA].E;
tc++;ta++;
}
else{
C.DATA[TC].I=B.DATA[TB].I;
C.DATA[TC].J=B.DATA[TB].J;
C.DATA[TC].E=B.DATA[TB].E;
tc++;tb++;
}
}
}//while
while (TA&LT;=A.TU) {//processing the remaining non 0 yuan in a
C.DATA[TC].I=A.DATA[TA].I;
C.DATA[TC].J=A.DATA[TA].J;
C.DATA[TC].E=A.DATA[TA].E;
tc++;ta++;
}
while (TB&LT;=B.TU) {//processing B is not 0 yuan remaining
C.DATA[TC].I=B.DATA[TB].I;
C.DATA[TC].J=B.DATA[TB].J;
C.DATA[TC].E=B.DATA[TB].E;
tc++;tb++;
}
}//
C.TU=TC;
Print_matrix (c);
}
6. Matrix Input algorithm
The number of rows, columns, non-0-tuple, and each non-0 element used for the input matrix. The input algorithm is as follows:
//*****************************************
* Matrix Input algorithm *
//*****************************************
Status Input_matrix (Tabletype *t)
{
scanf (T->mu, T->nu, t->tu); Get matrix row number, non 0-element number
for (i=1;i<=tu;i++)
scanf (T->data [I].i, T->data [I].j,t->data [I].E];
return OK;
}
7. Matrix Output algorithm
The ternary group is output to the screen in a matrix, the algorithm is as follows:
//*****************************************
* Matrix Output function *
//*****************************************
Status Print_matrix (tabletype m) {
k=1;
for (i=1;i<=m.mu;i++) {
for (j=1;j<=m.nu; j + +) {/* Non 0 elements */
if ((m.data[k].i==i) && (m.data[k].j==j)) {
printf (M.DATA[K].E);
k++;
}
Else
printf ("0"); /* 0 Elements */
}
printf ("\ n");
}
}
8. Cal_matrix function
In the matrix multiplication operation, it is necessary to count the number of the first non-0-tuple in each row of the matrix in the ternary table, the algorithm is as follows:
void Cal_matrix (Tabletype *m) {
Computes the first non-0-bit ordinal in each row of a matrix
for (ROW=1;ROW&LT;=M-&GT;MU; row++)
num[row]=0;
for (T=1;T&LT;=M-&GT;TU; t++)
Num[m->data [t].i]++;
M->rpos [1]=1;
for (ROW=2;ROW&LT;=M-&GT;MU; row++)
M->rpos [Row]=m->rpos [row-1]+num[row-1];
}
2.4 Program Testing
This section gives a screen of the program's running results, as well as a test analysis.
2.5 Impressions and Experiences
This part gives the problem in the process of algorithm design and the problem and harvest of program debugging process.
3. Requirements
The source program has no syntax errors and the result is correct;
The design report is written according to specifications.
The final submission of the course design includes: source program and course design report.
Http://www.daixie0.com/contents/13/1307.html

Our Direction field: Window Programming numerical algorithm AI Artificial Intelligence financial statistical Metrology analysis Big Data network programming Web programming Communication Programming game Programming Multimedia Linux plug-in programming API image processing embedded/Microcontroller database programming console process and thread Network security assembly language Hardware programming software Design Engineering Standard Rules. The generation of programming languages or tools including, but not limited to, the following ranges:

C/c++/c# Write

Java Write generation

It generation

Python writes

Tutoring Programming Jobs

The MATLAB Generation writes

Haskell writes

Processing Write

Linux Environment Setup

Rust Generation Write

Data Structure assginment Data structure generation

MIPS Generation Writing

Machine Learning Job Writing

Oracle/sql/postgresql/pig database Generation/Generation/Coaching

Web development, Web development, Web site jobs

Asp. NET Web site development

Finance insurace Statistics Statistics, regression, iteration

Prolog write

Computer Computational Method Generation

Because of professional, so trustworthy. If necessary, please add qq:99515681 or e-mail:[email protected]

: Codinghelp

Data structure/C + + programming job generation, C + + processing English homework

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.