can you help

Discussion in 'Mac Programming' started by hena, Jun 26, 2008.

  1. macrumors newbie

    Joined:
    Jun 26, 2008
    #1
    hello can you helo i am hena please if you can help me to solve this project
    project :
    1. Consider the C-like code below. What values do the last three lines print out? If it’s printing an address, tell me what variable’s address it is printing. Assume that the “print” statement “does what you’d expect” - it prints out the value of the address or variable after it.


    int p[20];
    for (i=0; i<20; i++)
    {p = i;}
    int *mypointer = &p[0];
    print *mypointer;
    print p;
    print p[3];


    2. Processor P1 has a 1GHz clock, and processor P2 has a 2GHz clock. They have completely different instruction sets, but they both execute exactly 1 instruction per cycle. Which processor has better performance and why? You must explain your answer to get credit.




    3. Write a MIPS assembly program that reads a string of integers and computes whether it (the number represented by the entire string) is prime or not. Assume the string of integers has no more than 5 digits.


    4. Write a MIPS assembly program that sorts, in ascending order, all of the characters that are provided as inputs (sorting is done by ASCII code). Assume you won’t get more than 100 characters. Some inputs may repeat. The pseudo-code for your program is below.
     

    Attached Files:

  2. macrumors regular

    Joined:
    Jan 19, 2006
    #2
    1) Firsts prints prints 0, second the address of p, third prints 3.

    2) With different instruction sets it's impossible to compare.
     
  3. Moderator emeritus

    robbieduncan

    Joined:
    Jul 24, 2002
    Location:
    London
    #3
    Do your own homework/course work. Seriously: if we answer this what will you have learnt? Nothing that's what. I'm reporting this in the hope that the thread gets closed.
     
  4. Moderator emeritus

    Joined:
    Jul 4, 2004
    #4
    This doesn't break any forum rules and it's probably best to just ignore it.
     
  5. Guest

    Darkroom

    Joined:
    Dec 15, 2006
    Location:
    Montréal, Canada
    #5
    damn... i wish i could afford to study programming...
     
  6. Moderator emeritus

    robbieduncan

    Joined:
    Jul 24, 2002
    Location:
    London
    #6
    Fair enough. It just makes me very angry that people who cheat and lie their way through life like this may end up getting qualified and giving my industry a bad name when they are found to know nothing :mad:
     
  7. macrumors 6502

    Joined:
    Apr 28, 2008
    #7
    I feel you, bud.
     
  8. macrumors newbie

    Joined:
    Feb 3, 2008
    #8
    Its worse than that, they go into management and end up being decision makers on how to implement projects. :D
     
  9. macrumors 68040

    lee1210

    Joined:
    Jan 10, 2005
    Location:
    Dallas, TX
    #9
    Computer Architecture was one of the best courses I took in my undergrad CS program. I would never imagine trying to get around the work. If you don't like CS, there's always MIS or other such degrees that aren't as technically rigorous. If you really have no idea, and you have read the book (Sounds like Patterson and Hennessy) thoroughly, you should speak with the professor or a TA to get help with this. Asking us to do your homework is no better than just copying it from someone else.

    Download spim here:
    http://pages.cs.wisc.edu/~larus/spim.html

    And build it for your OS X machine (I assume you have a mac since you're posting here). Then get to work writing the MIPS ASM.

    As for the first two questions, I don't believe you even made an attempt.

    -Lee
     
  10. macrumors 6502a

    Joined:
    Jan 15, 2007
    #10
    Just give bad advice :p

    To the op, your program prints "Do your own homework!" in an infinite loop :p
     
  11. macrumors 603

    jeremy.king

    Joined:
    Jul 23, 2002
    Location:
    Fuquay Varina, NC
    #11
    While I agree with you completely and respect your presence in this forum, you seemed to have no real issues doing someone else's job for them. I commend you on insisting that the OP learn Cocoa 101, but you still provided a lot of code fixes...I don't really see the difference and try to avoid both situations.
     
  12. Moderator emeritus

    robbieduncan

    Joined:
    Jul 24, 2002
    Location:
    London
    #12
    Whilst I see your point entirely, I think that is a very different set of circumstances. In that case the individual has clearly made some effort, was asking for help with a specific part of their existing code, not for the whole thing to be done for them and has gone on to prove that I was right: they have solved further problems on their own and have put the effort in. In that case it appears that something has been dumped on them unasked and they are trying their hardest. In this case it appears that someone has signed up for this and is not trying at all.
     
  13. macrumors 603

    jeremy.king

    Joined:
    Jul 23, 2002
    Location:
    Fuquay Varina, NC
    #13
    I guess I looked at as students don't get paid $$$ as a result from our help, programmers do.
     
  14. Moderator emeritus

    robbieduncan

    Joined:
    Jul 24, 2002
    Location:
    London
    #14
    Lol, that's a good point. Maybe I should setup a little side business. Your basic Cocoa problems solved, $50 an hour :D
     

Share This Page