Class assignment

This is a discussion on Class assignment within the C Programming forums, part of the General Programming Boards category; Originally Posted by tmnismo91 Any words of wisdom? Confucius says, "Search the FAQ. There be many articles suited for many ...

  1. #16
    Deathray Engineer MacGyver's Avatar
    Join Date
    Mar 2007
    Posts
    3,211
    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."

    http://faq.cprogramming.com/cgi-bin/smartfaq.cgi


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

  3. #18
    CSharpener vart's Avatar
    Join Date
    Oct 2006
    Location
    Rishon LeZion, Israel
    Posts
    6,474
    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
    The first 90% of a project takes 90% of the time,
    the last 10% takes the other 90% of the time.

  4. #19
    Registered User MacNilly's Avatar
    Join Date
    Oct 2005
    Posts
    311
    ^^ 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.

Page 2 of 2 FirstFirst 12
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, 11:05 AM
  3. structure vs class
    By sana in forum C++ Programming
    Replies: 13
    Last Post: 12-02-2002, 06: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

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