Cash-back offer from May 7th to 12th, 2024: Get a flat 10% cash-back credited to your account for a minimum transaction of $50.Post Your Questions Today!

Question DetailsNormal
$ 28.00

Project 6 Program Design | Complete Solution

Question posted by
Online Tutor Profile
request

Project 6, Program Design


1. This program will be graded based on whether the required functionality were implemented correctly instead of whether it produces the correct output, for the functionality part (80% of the grade).
Modify selection_sort.c so that it includes the following functions:
void selection_sort(int *a, int n);
int *find_largest(int *a, int n);
void swap(int *p, int *q);
selection_sort function: it should call find_largest function and swap function.
find_largest function: when passed an array of length n, the function will return a pointer to the array’s largest element. The function should use pointer arithmetic – not subscripting – to visit array elements. In other words, eliminate the loop index variables and all use of the [] operator in the function.
swap function: when passed the addresses of two variables, the function should exchange the values of the variables:
swap(&i, &j); /* exchange values of i and j */
Your program will call find_largest function and swap function in selection_sort function.


A vector is an ordered collection of values in mathematics. An array is a very straightforward way to implement a vector on a computer. Two vectors are multiplied on an entry-by-entry basis, e.g. (1, 2, 3) * (4, 5, 6) = (4, 10, 18).
Write a program that include the following functions. The functions should use pointer arithmetic (instead of array subscripting). In other words, eliminate the loop index variables and all use of the [] operator in the functions.
void multi_vec (int *v1, int *v2, int *v3, int n);
int comp_vec(int *v1, int *v2, int n);
The multi_vec function multiplies vectors v1 and v2 and stores the result in v3. n is the length of the vectors.
The comp_vec function compares v1 and v2, return 1 if vectors v1 and v2 are equal (their corresponding components are equal), and 0 otherwise. n is the length of the vectors.
In the main function, ask the user to enter the length of the vectors, declare two arrays with the length, read in the values for two vectors, and call the two functions to compute the multiplication and comparison of them. The main function should display the result.
Enter the length of the vectors: 5
Enter the first vector: 3 4 9 1 4
Enter the second vector: 5 7 2 6 8


Output:
The multiplication of the vectors is: 15 28 18 6 32
The vectors are not the same.
Before you submit:
1. Compile with –Wall. Be sure it compiles on circe with no errors and no warnings.
gcc –Wall selection_sort.c
gcc –Wall vector.c
2. Be sure your Unix source file is read & write protected. Change Unix file permission on Unix:
chmod 600 selection_sort.c
chmod 600 vector.c
3. Test your program with the shell scripts on Unix:
chmod +x try_sort
./try_sort
chmod +x try_vector
./try_vector
Total points: 100 (50 points each problem)
1. A program that does not compile will result in a zero.
2. Runtime error and compilation warning 5%
3. Commenting and style 15%
4. Functionality 80%


Programming Style Guidelines
The major purpose of programming style guidelines is to make programs easy to read and understand. Good programming style helps make it possible for a person knowledgeable in the application area to quickly read a program and understand how it works.
1. Your program should begin with a comment that briefly summarizes what it does. This comment should also include your name.
2. In most cases, a function should have a brief comment above its definition describing what it does. Other than that, comments should be written only needed in order for a reader to understand what is happening.
3. Information to include in the comment for a function: name of the function, purpose of the function, meaning of each parameter, description of return value (if any), description of side effects (if any, such as modifying external variables)
4. Variable names and function names should be sufficiently descriptive that a knowledgeable reader can easily understand what the variable means and what the function does. If this is not possible, comments should be added to make the meaning clear.
5. Use consistent indentation to emphasize block structure.
6. Full line comments inside function bodies should conform to the indentation of the code where they appear.
7. Macro definitions (#define) should be used for defining symbolic names for numeric constants. For example: #define PI 3.141592
8. Use names of moderate length for variables. Most names should be between 2 and 12 letters long.
9. Use underscores to make compound names easier to read: tot_vol or total_volumn is clearer than totalvolumn.

Available Answer
$ 28.00

[Solved] Project 6 Program Design | Complete Solution

  • This solution is not purchased yet.
  • Submitted On 03 Oct, 2015 04:29:57
Answer posted by
Online Tutor Profile
solution
#include #define N 10 void selection_sort(int *a, int...
Buy now to view the complete solution
Other Similar Questions
User Profile
markk...

computer research document

"Case Project 6-2: UTM Comparison Create a table of four UTM devices available today. Include the vendor name, pricing, a list of features, the type of protections it provides, etc. Based on your research, assign a value of...
User Profile
markk...

UTM comparison homework

"Case Project 6-2: UTM Comparison Create a table of four UTM devices available today. Include the vendor name, pricing, a list of features, the type of protections it provides, etc. Based on your research, assign a value of...
User Profile
markk...

computer research document

Network Firewall ComparisonUse the Internet to identify three network firewalls, and create a chart that compares their features. Note if they are rule-based or application-aware, perform stateless or stateful packet filteri...
User Profile
markk...

computer research document

"Case Project 6-2: UTM Comparison Create a table of four UTM devices available today. Include the vendor name, pricing, a list of features, the type of protections it provides, etc. Based on your research, assign a value of...
User Profile
homew...

MM255 PROJECT 6

Total points for project: 45 points. Projects must be submitted as a Microsoft Word document and uploaded to the Dropbox for Unit 6. All Projects are due by Tuesday at 11:59 PM ET of the assigned Unit. NOTE: Project proble...

The benefits of buying study notes from CourseMerits

homeworkhelptime
Assurance Of Timely Delivery
We value your patience, and to ensure you always receive your homework help within the promised time, our dedicated team of tutors begins their work as soon as the request arrives.
tutoring
Best Price In The Market
All the services that are available on our page cost only a nominal amount of money. In fact, the prices are lower than the industry standards. You can always expect value for money from us.
tutorsupport
Uninterrupted 24/7 Support
Our customer support wing remains online 24x7 to provide you seamless assistance. Also, when you post a query or a request here, you can expect an immediate response from our side.
closebutton

$ 629.35