Thread: Homework help

Threaded View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Registered User
    Join Date
    Jul 2008
    Posts
    38

    Homework help

    I am a 16-year old Filipino who is a 2nd year college student at Informatics Computer Institute (Malolos, Bulacan branch). I have a coursework assignment in CS215 (C Programming) and I need your extensive help. Please post the following codes so that I only need to worry about the compilation.

    Here are the requirements for the assignment:

    1. Do not add any nonsense in my C code, for my lecturer will not accept any nonsense added in my code!!!
    2. Be able to demonstrate and explain programs to your lecturer.
    3. Submit a physical file holding the following:
    a) Printed hard copy of all programs
    b) Printed test cases
    c) All soft copy programs in a CD-R (please attach firmly to
    physical file)
    4. Do what is exactly asked in the questions.

    The assignment is worth 40 points.
    The deadline is July 25, 2008, so you better hurry up.

    Question 1 (24 points)

    Question 1 contains 12 sub-questions which will be in separate C programs. I'll be the one who will design the filenames for each program.

    Each of the functions below needs to be run in a program. Each of the programs should have at least one test case (with a screen capture) which shows the succesful running of the program. Each sub-question is worth 2 points.

    a) Write a function called ChangeToNext that takes in an uppercase character parameter ch. The function returns the next uppercase character if ch is between 'A' and 'Y'. If ch == 'Z', the function returns 'A'. You may assume that the character parameter ch is always an uppercase alphabetic character.

    b) Write a function called Difference that takes in an integer array intarr of size 10. The function returns the difference between the sum of all values from cell 0 to 4 and the sum from cell 5 to 9. For example, if intarra[10]={1,1,1,1,1,2,2,2,2,2}, Difference (intarr) returns -5 ((1+1+1+1+1) - (2+2+2+2+2)

    c) Write a function PerimeterMinusCenter that takes in a two-dimensional array called intarr of 3 rows and 3 columns. The function sums the values in the perimeter of the array. It then returns the difference of this sum and the center value (the value in cell row 1, column 1 or [1][1]).

    For example, if
    Code:
    intarr[3][3] = {1,1,1}
                                    {1,2,1}
                                    {1,1,1}
                                    };
    PerimeterMinusCenter(intarr) returns 6 (1+1+1+1+1+1+1+1 - 2).

    d) Write a function Compare that takes in a two-dimensional array called intarr of 3 rows and 3 columns. The function sums up separately the values in the diagonal of the array and the non-diagonal values. It then compares these two sums and return 1 if the diagonal sum is larger than the non-diagonal sum or 0 otherwise.

    For example, if
    Code:
    intarr[3][3] = {{1,2,2}
                                      {2,1,2}
                                      {2,2,1}
                                      };
    Compare(intarr) returns 0 (since (1+1+1) < (2+2+2+2+2+2)).

    e) Write a recursive function called CountEvenASCII that takes in a string parameter str and return the number of characters with even ASCII codes. For example CountEvenASCII("ABCDE") returns 2 (as B and D are of even ASCII codes).

    f) Change your solution above (sub-question e) into an iterative solution.

    g) Write a function called ReturnNextCase that takes in a character parameter ch and returns the next alphabet in the other case. For example, ChangeCase('A') returns 'b' and ChangeCase('a') returns 'B'. You may always assume the character parameter ch is always alphabetic.

    h) Write a function called ReturnASCIIDifference that takes in a string parameter str. The function sums up separately even ASCII characters and odd ASCII characters and return their difference. For example, ReturnASCIIDifference('ABCD') returns 2 (as the ASCII values of 'A', 'B', 'C', and 'D' are 65, 66, 67, and 68 respectively and (66+68) - (65+67) = 2).

    i) Write a function called CheckPosNeg that takes in a reference integer parameter num. The function returns 0 if the content of the reference parameter is a positive number and 1 otherwise.

    j) Write a function called PrintToZero that takes in a reference integer parameter num. The function prints out the content of num up to zero. For example, if *num=10, then PrintToZero(num) prints 10 9 8 7 ... 0..
    Last edited by mkdl750; 07-03-2008 at 09:56 PM. Reason: additional info

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Homework
    By kermi3 in forum A Brief History of Cprogramming.com
    Replies: 11
    Last Post: 11-03-2001, 04:39 PM
  2. Homework
    By kermi3 in forum C Programming
    Replies: 10
    Last Post: 09-27-2001, 04:49 PM
  3. Homework
    By kermi3 in forum C++ Programming
    Replies: 15
    Last Post: 09-26-2001, 03:16 PM
  4. Homework
    By kermi3 in forum Windows Programming
    Replies: 5
    Last Post: 09-15-2001, 11:48 AM
  5. Homework
    By kermi3 in forum C Programming
    Replies: 0
    Last Post: 09-10-2001, 01:26 PM

Tags for this Thread