Highest and lowest value

This is a discussion on Highest and lowest value within the C Programming forums, part of the General Programming Boards category; Hi. I have an applikation with 7 point variables, i write values to the variables and i whant the applikation ...

  1. #1
    Registered User
    Join Date
    Jan 2010
    Posts
    1

    Highest and lowest value

    Hi. I have an applikation with 7 point variables, i write values to the variables and i whant the applikation to decide wich variable has the highest and lowest variables.

    I write values to the variables like this:

    PHP Code:
        float point1point2,point3,point4,point5,point6,point7;

        
    printf("point 1: ");
        
    scanf("%f", &point1);

        
    printf("point 2: ");
        
    scanf("%f", &point2);

        
    printf("point 3: ");
        
    scanf("%f", &point3);

        
    printf("point 4: ");
        
    scanf("%f", &point4);

        
    printf("point 5: ");
        
    scanf("%f", &point5);

        
    printf("point 6: ");
        
    scanf("%f", &point6);

        
    printf("point 7: ");
        
    scanf("%f", &point7); 

  2. #2
    Registered User
    Join Date
    Mar 2009
    Posts
    399
    Code:
    float *max = &point1;
    float *min = &point1;
    
    if (point2 > *max)
    {
    	max = &point2;
    }
    
    if (point2 < *min)
    {
    	min = &point2;
    }
    
    ...

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Extracting lowest and highest score from array
    By sjalesho in forum C Programming
    Replies: 6
    Last Post: 03-01-2011, 05:24 PM
  2. HELP: Exclude the highest and lowest number...
    By Ocin101 in forum C Programming
    Replies: 12
    Last Post: 07-21-2009, 01:51 AM
  3. Replies: 3
    Last Post: 02-22-2009, 01:54 PM
  4. Trying to sort numbers from lowest to highest
    By jw232 in forum C++ Programming
    Replies: 21
    Last Post: 01-21-2008, 03:03 PM
  5. Displaying highest and lowest values
    By beastofhonor in forum C++ Programming
    Replies: 3
    Last Post: 10-29-2006, 07:24 PM

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