ChorongBias

function6

Jan 9th, 2018
78
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.63 KB | None | 0 0
  1. {
  2.     int lowestIndex, highestValue, total, choice, n, sortedArray[12];
  3.     lowestIndex = 0;
  4.     printf("Select a Road User\n");
  5.     printf("1)Pedestrian\n2)Motor Cyclists\n3)Motor Car\n4)Light Truck\n5)Truck\n");
  6.     scanf_s(" %d", &choice);
  7.     if (choice == 1)
  8.     {
  9.            total=12;
  10.         highestValue = Pedestrian[0];
  11.         while (lowestIndex < total)
  12.         {
  13.             for (n = lowestIndex; n < 12; n++)
  14.             {
  15.                 if (Pedestrian[n] > highestValue)
  16.                 {
  17.                     highestValue = Pedestrian[n];
  18.                     sortedArray[n] = highestValue;
  19.                 }
  20.             }
  21.             lowestIndex++;
  22.         }
  23.         printf("The highest to lowest number of injuries is %d for Pedestrians", sortedArray[n]);
  24.  
  25.     }
  26. }
Advertisement
Add Comment
Please, Sign In to add comment