Create and utilize compound conditions

Assignment Help C/C++ Programming
Reference no: EM131038783

1. Learner Objectives:

At the conclusion of this programming assignment, participants should be able to:

Apply and implement all your problems solving and C skills developed this semester!

Apply and implement pointers in C

Manipulate and split arrays and strings

Apply and implement recursive functions

II. Prerequisites:

Before starting this programming assignment, participants should be able to:

Analyze a basic set of requirements and apply top-down design principles for a problem

Apply repetition structures within an algorithm

Construct while (), for (), or do-while () loops in C

Compose C programs consisting of sequential, conditional, and iterative statements

Eliminate redundancy within a program by applying loops and functions

Create structure charts for a given problem

Open and close files

Read, write to, and update files

Apply standard library functions: fopen (), fclose (), fscanf (), and fprintf ()

Compose decision statements ("if" conditional statements)

Create and utilize compound conditions

III. Overview & Requirements:

For this assignment you will be required to write functions which solve each of the following problems. You must place all of your functions in one project. If you use any code that you find online, you must reference it in comments.

1. Write a function called my_str_n_cat() that accepts pointer to a destination character array, a pointer to a source character array (which is assumed to be a string), and a integer n, and returns the pointer to the destination character array. This function needs to copy at most n characters, character by character, from the source character array to the end of the destination character array. If a null character is encountered before n characters have been encountered, copying must stop. You may NOT use any functions found in <string.h> to solve this problem! Note: you may use array or pointer notation in this function.

2. Write a function called bubble_sort() that accepts an array of pointers to strings and the number of strings as arguments, and returns nothing. The function sorts the strings according to the following algorithm:

1. set the marker U for the unsorted section at the end of the list (U is an integer index value)
2. while the unsorted section has more than one element do steps 3 through 7
3. set the current element marker C at the second element of the list (C is an integer index value)
4. while C has not passed U do steps 5 and 6
5. if the item at position C is less than the item to its left then exchange these two items
6. move C to the right one position
7. move U left one position
8. stop

Your implementation for this function may NOT use strcpy(). You may only exchange or swap pointers, but NOT actually make copies of the strings!

3. Write a recursive function called sum_primes() that accepts an unsigned integer, n, as an argument, and returns the sum of all primes from 2 to n. You must use recursion to solve this problem!

4. Write a function called smallest_sum_sequence() that accepts an array of signed integers and the number of items in the array as arguments, and returns the smallest sum of a sequence of numbers in the array. A sequence is defined as a single item or multiple items that are in adjacent memory locations.

5. Write a function called max_consecutive_integers() that accepts a two-dimensional array of signed integers, the number of rows, the number of columns as input parameters, and two pointers as output parameters (one of these pointers is actually a pointer to a pointer, i.e. two stars!). The function finds the maximum consecutive sequence of one integer. The first pointer stores the address the start of the maximum consecutive sequence of the same integer. The second indirectly stores the number the same consecutive integers in a row. These sequences may wrap from one row to the next.

Row/Column

0

1

2

3

4

0

-5

[$1000]

6

[$1004]

0

[$1008]

2

[$1012]

2

[$1016]

1

2

[$1020]

2

[$1024]

2

[$1028]

9

[$1032]

3

[$1036]

2

3

[$1040]

3

[$1044]

2

[$1048]

1

[$1052]

-8

[$1056]

3

7

[$1060]

-2

[$1064]

6

[$1068]

0

[$1072]

4

[$1076]

Reference no: EM131038783

Questions Cloud

Major characteristics or problems of developing countries : Describe and evaluate briefly five major characteristics or problems of developing countries' agricultural sectors. Make reference to specific countries or regions.
What is the purpose of conducting tax research : There are 3 general views regarding interperiod income tax allocation: no allocation, partial allocation, and comprehensive allocation. Defend the position of an allocation of your choice (no allocation, partial or comprehensive allocation).
Social cost of common access : The fishermen face a private marginal cost, but do not consider the additional cost of depleting the stock of fish in the pond. Graph the demand, private cost, and marginal social cost for fish from this pond, showing the efficient quantity, the a..
How did great britain get rich off of atlantic slave trade : How did Great Britain get rich off of the Atlantic Slave Trade? What are the effects from colonialism found in our modern economies? Name 2 effects.
Create and utilize compound conditions : Eliminate redundancy within a program by applying loops and functions - Create structure charts for a given problem
Discuss the role of gender in the greek and roman worlds : Discuss the role of gender in the Greek and Roman worlds. A Short Paper Assignment allows you, early in the course, to demonstrate your research skills to your instructor and to receive feedback that will benefit you when you write your research pa..
What point does the character of faith-motivated activism : To religious extremists, it is "God's law" that has been revealed to-and properly interpreted by-the extremist movement. At what point does the character of faith-motivated activism become extremist and terrorist?
Fixed price and a cost incentive price : What are the potential benefits and pitfalls of a Fixed Price and a Cost Incentive Price contract to the client and to the contractor with respect to the risk impact that each assumes with both types of contracts?
What are the implications to the organization : Discuss the reasons for the accounting profession's adopting a code of professional conduct.

Reviews

Write a Review

C/C++ Programming Questions & Answers

  Write a program that will call a function

Write a program that will call a function called writeDataToFile to prompt a user for their first name, last name and zip code, and print this information to a file called "UserData.txt". The main function should prompt the user for the same infor..

  Create valle products accdb database file

Create a new table named Orders using the table design below. You may create your table in design view or datasheet view. Save the Orders table as Orders Your Name. Define a one-to-many relationship between the Customer table and Orders table. Ri..

  Print each employee''s identification number

1) in a program you need to store the identification numbers of 10 employees (as ints) and their weekly gross pay (as doubles) A) Define two arrays that may be used in parallel to store the 10 employee indentificcation numbers and gross pay amounts B..

  Write a program that reads numbers

Write a C++ program that reads N positive numbers from the keyboard, calculates and shows the smallest number of all numbers

  Use structures to create c program to compute student record

Explain the following and give their suitable syntax. A pointer. Use structures to create C program to compute and store student records of class.

  Write a recursive function that takes a string

Write a recursive function that takes a string as a parameter and prints its reversal in the same function in C++

  A hierarchical jpeg encode decoder for greyscale images

This project is to develop a program that implements a hierarchical JPEG encoder/decoder for greyscale images.

  In this program you will implement a simple reverse polish

in this program you will implement a simple reverse polish notation rpn calculator. rpn is a notation in which

  Write a function base

Write a function base(b,x) that computes the representation of x in an arbitrary base b.

  Program to record the temperature and pressure

Write a program to record the temperature and pressure values in a scientific experiment and store the data in two one-dimensional arrays, then identify the extreme values of pressure and temperature. The array size is 20.

  Write program to input series of hourly temperatures

Create and write a c++ program which inputs series of 24 hourly temperatures from file, and outputs bar chart (using stars) of temperatures for the day.

  1 implement the tronomino tiling algorithm your program

1. implement the tronomino tiling algorithm. your program should take an arbitrary input positive integer k in the

Free Assignment Quote

Assured A++ Grade

Get guaranteed satisfaction & time on delivery in every assignment order you paid with us! We ensure premium quality solution document along with free turntin report!

All rights reserved! Copyrights ©2019-2020 ExpertsMind IT Educational Pvt Ltd