Thread: Class assignment

  1. #16
    Deathray Engineer MacGyver's Avatar
    Join Date
    Mar 2007
    Quote Originally Posted by tmnismo91 View Post
    Any words of wisdom?
    Confucius says, "Search the FAQ. There be many articles suited for many different circumstances."

  2. #17
    Registered User
    Join Date
    Jun 2007
    while(i < 10)
    		array[i] = rand() % 100;
    		printf("%d\n", array[i]);
    Ok so I generated my random integers. Now I need to print the highest random integer.

  3. #18
    Hurry Slowly vart's Avatar
    Join Date
    Oct 2006
    Rishon LeZion, Israel
    1. set max_value to array[0]
    2. loop for all other member of the array
    3. if current value is bigger then max_value - replace max_value
    4. after the for - print the found max_value
    All problems in computer science can be solved by another level of indirection,
    except for the problem of too many layers of indirection.
    David J. Wheeler

  4. #19
    Registered User MacNilly's Avatar
    Join Date
    Oct 2005
    CA, USA
    ^^ One of the best programming techniques right there.

    Put your problem into english words, in a step-by-step format, what needs to be done to solve the problem. Write down the problem first. The words are called pseudo-code and the whole thing is called an algorithm. They outta teach this stuff before even touching C, IMO.

    I suggest you draw out a diagram of an array and "deck-check" your algorithm before even beginning to code it. Make sure your method works to get the right answer. With a simple of a problem as yours is, you should be able to code a logic-bug free C program straight away.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. class composition constructor question...
    By andrea72 in forum C++ Programming
    Replies: 3
    Last Post: 04-03-2008, 05:11 PM
  2. Replies: 3
    Last Post: 10-31-2005, 12:05 PM
  3. structure vs class
    By sana in forum C++ Programming
    Replies: 13
    Last Post: 12-02-2002, 07:18 AM
  4. Abstract class problem
    By VanJay011379 in forum C++ Programming
    Replies: 9
    Last Post: 07-31-2002, 01:30 PM
  5. i need help with errors in my assignment for class
    By azrael13302473 in forum C++ Programming
    Replies: 1
    Last Post: 07-04-2002, 06:02 PM