turbo c++ user

This is a discussion on turbo c++ user within the C++ Programming forums, part of the General Programming Boards category; hi everyone. im here to ask everyone's help. im a student, enrolled in a turbo c++ subject. PLEASE help me ...

  1. #1
    Registered User
    Join Date
    Jul 2007
    Location
    manila, PI
    Posts
    2

    turbo c++ user

    hi everyone. im here to ask everyone's help. im a student, enrolled in a turbo c++ subject.
    PLEASE help me answer my PROJECT...please, please...here are the programs, i need codes of it.

    a.)

    Write a function PerimeterMinusCenter that take 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).

    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)).



    b.)

    Write a function Compare that take 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 and 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)).

    c.)

    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).

    d.)

    Change your solution above into an iterative solution.


    HELP will be very much appreciated...thank you guys, i hope atleast one can help me out here...
    Last edited by Salem; 07-08-2007 at 10:20 AM. Reason: fix tag abuse

  2. #2
    Ethernal Noob
    Join Date
    Nov 2001
    Posts
    1,901
    **** ***

    write a program to decode what I just said.

    I also have a feeling you are going to fail teh turbo C++

  3. #3
    Registered User
    Join Date
    Jul 2007
    Location
    manila, PI
    Posts
    2

    Talking

    Quote Originally Posted by indigo0086 View Post
    **** ***

    write a program to decode what I just said.

    I also have a feeling you are going to fail teh turbo C++
    Hi! i really appreciate your answer! that could helpme a lot...

  4. #4
    Internet Superhero
    Join Date
    Sep 2006
    Location
    Denmark
    Posts
    934
    Quote Originally Posted by nampootah View Post
    Hi! i really appreciate your answer! that could helpme a lot...
    Try and show us what you have done so far, what have you tried to solve the problem?

  5. #5
    The larch
    Join Date
    May 2006
    Posts
    3,573
    It doesn't help much to put your assignment in code tags (making it practically unreadable). Put the code you have in code tags.
    I might be wrong.

    Thank you, anon. You sure know how to recognize different types of trees from quite a long way away.
    Quoted more than 1000 times (I hope).

  6. #6
    Deathray Engineer MacGyver's Avatar
    Join Date
    Mar 2007
    Posts
    3,211
    How about we work out a deal where you write me a deathray that can blow up entire cities and armies, has low recharge time, and is cheap to manufacture, and I'll pass your course for you?
    Last edited by MacGyver; 07-08-2007 at 10:27 AM.

  7. #7
    Frequently Quite Prolix dwks's Avatar
    Join Date
    Apr 2005
    Location
    Canada
    Posts
    8,046
    For a):
    Summing the values located around the parameter of an array can be done with two for loops. The first loop goes horizontally and encompasses the top and bottom rows of the 2D array. The second goes vertically and does the left and the right -- but the second for loop has to start one down and end one up from the bottom, because the corners were already summed by the first for loop.

    For b), you could sum the entire array as well as the diagonals. Then the non-diagonal sum could be calculated by total-diagonal.

    Assuming that the array is "square" (the first dimension is the same as the second), diagonal calculation could be done in one for loop, or perhaps two. You'd use array[i][i] and array[i][max-i] or something.

    For c), this might be of some use: http://faq.cprogramming.com/cgi-bin/...&id=1043284385
    dwk

    Seek and ye shall find. quaere et invenies.

    "Simplicity does not precede complexity, but follows it." -- Alan Perlis
    "Testing can only prove the presence of bugs, not their absence." -- Edsger Dijkstra
    "The only real mistake is the one from which we learn nothing." -- John Powell


    Other boards: DaniWeb, TPS
    Unofficial Wiki FAQ: cpwiki.sf.net

    My website: http://dwks.theprogrammingsite.com/
    Projects: codeform, xuni, atlantis, nort, etc.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Replies: 4
    Last Post: 04-03-2008, 09:07 PM
  2. Add/Delete Remotely a user
    By Scarvenger in forum Windows Programming
    Replies: 5
    Last Post: 03-24-2008, 08:36 AM
  3. Replies: 4
    Last Post: 04-21-2004, 04:18 PM
  4. ~ User Input script help~
    By indy in forum C Programming
    Replies: 4
    Last Post: 12-02-2003, 05:01 AM
  5. Stopping a user from typeing.
    By knave in forum C++ Programming
    Replies: 4
    Last Post: 09-10-2001, 12:21 PM

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21