Thread: Find minimum and maximum value in a variable of a struct

  1. #1
    Registered User
    Join Date
    Jul 2015
    Posts
    9

    Find minimum and maximum value in a variable of a struct

    I have a product sales management program where I have a structure for storing product data, another to store customer data and another to store sales data. When I insert a new sale has to be associated with a existing product serial number and the id of a existing customer. How do I guarantee when data products and customers struct are changed the sales struct is updated?
    Here's what I have:


    Code:
    typedefstruct{
    int idcustomersale;
    char serialnumberproductsale[10]
    float final_price;
    }stsales;
    
    
    int main()
    {
    
       stsales sales[1000];
       int countsales=0;
    
    }
    
    //Code of function find_min_max...........
    Any help!!!!

  2. #2
    Tweaking master Aslaville's Avatar
    Join Date
    Sep 2012
    Location
    Rogueport
    Posts
    528
    How do I guarantee when data products and customers struct are changed the sales struct is updated?
    Well, you have to do that yourself.

    The code to update the sales struct should be wrapped inside the code that changed the 'product' and 'customers' structs.

    Also, this thread might be in the wrong place....

  3. #3
    Registered User
    Join Date
    Jun 2011
    Posts
    4,513
    Quote Originally Posted by Aslaville View Post
    Also, this thread might be in the wrong place....
    Indeed, this appears to be a rehash of their post from yesterday.

  4. #4
    Gawking at stupidity
    Join Date
    Jul 2004
    Location
    Oregon, USA
    Posts
    3,218
    This isn't C#...
    If you understand what you're doing, you're not learning anything.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Minimum and maximum in all positions.
    By OctavianC in forum C Programming
    Replies: 6
    Last Post: 01-04-2015, 12:51 PM
  2. finding mean minimum and maximum values
    By begginer in forum C Programming
    Replies: 1
    Last Post: 03-25-2011, 11:55 PM
  3. maximum and minimum
    By aslak in forum C Programming
    Replies: 35
    Last Post: 12-14-2008, 03:54 PM
  4. Maximum and Minimum Values
    By swaugh in forum C Programming
    Replies: 7
    Last Post: 12-16-2006, 09:43 PM
  5. Maximum And Minimum
    By drdodirty2002 in forum C++ Programming
    Replies: 2
    Last Post: 10-19-2004, 12:39 AM

Tags for this Thread