QuestionQuestion

Step #7 - Create a function toBinary that receives a byte (char) and prints is value out in binary (with spaces every nibble). Print out the first 5 values if i_array using this function.
Step #8 - Create a function countRange311 that receives reference to an array of floating point values, a integer indicating how many elements are in the array and a int minimum and maximum values. The function will return the number of elements (after rounding) between min and max (inclusive). Next, declare an array of 10 integers at the top of the main function. Fill the array with a count (times three) of the number of values for each set of tens within the floating point array, i.e. index 0 will contain the count of rounded values in the array 0-9 >TIMES THREE, the second will be 10-19, etc. all the way to 90- 99. Use the countRange311 to fill the array.
Step #9 - Create a function histogram311 that receives a reference to an array of integer values calculated in the previous step and prints out a histogram showing the counts of the different values. The Y-axis should display count values from 0-19. The function should check the number of elements and return with a - 1 value if it is not 10.

Solution PreviewSolution Preview

These solutions may offer step-by-step problem-solving explanations or good writing examples that include modern styles of formatting and construction of bibliographies out of text citations and references. Students may use these solutions for personal skill-building and practice. Unethical use is strictly forbidden.

////////////////////////////////////////////////////////////////////////////////
//
//
//

// Include Files
#include <stdio.h>
#include <string.h>

#define NUM_TEST_ELEMENTS 100

// Functions

// looping through f_array and rounding up the f_array to the 2 digits to the right
// of the decimal point

void printfloatArr311(float f_array[], int x){
    for (int i=0; i<x; i++) {
       // last value doesnt print with a comma but a new line at the end
       if (i == x-1){
            printf("%.2f\n", f_array[i]);
       }
       else{
       printf("%.2f, ", f_array[i]);
       }
    }
}

// looping through i_array and print untill all numbers are presented

void printIntArr311(int i_array[], int x){
    for (int i=0; i<x; i++) {
       // last value doesnt print with a comma but a new line at the end
       if (i == x-1){
            printf("%d\n", i_array[i]);
       }
       else{
            printf("%d, ", i_array[i]);
       }
    }
}

// setting up an argument in the 2nd loop, if the first element is bigger than
// the next element, then swap their position until the whole array is sorted.

void bubbleSort311(int i_array[], int x){
    for (int i=0; i<x; i++) {
       for (int j=0; j < x-i-1; j++){
            if(i_array[j] > i_array[j+1]){
                int change = i_array[j];
                i_array[j] = i_array[j+1];
                i_array[j+1] = change;
            }
       }
    }
}

void toBinary(char num)
{
    char digs[8];
    for (int i = 0; i < 8; i++)
    {
       // Stores i-th binary digit (from right to left) in a sequence digs
       digs[i] = num % 2;
       num...

By purchasing this solution you'll be able to access the following files:
assign1.c.

$20.00
for this solution

PayPal, G Pay, ApplePay, Amazon Pay, and all major credit cards accepted.

Find A Tutor

View available C-Family Programming Tutors

Get College Homework Help.

Are you sure you don't want to upload any files?

Fast tutor response requires as much info as possible.

Decision:
Upload a file
Continue without uploading

SUBMIT YOUR HOMEWORK
We couldn't find that subject.
Please select the best match from the list below.

We'll send you an email right away. If it's not in your inbox, check your spam folder.

  • 1
  • 2
  • 3
Live Chats