subject

Complete the commented parts in the code below:

#include
#include
#include

// Functions

//
// Function : main

// Inputs : argc - the number of command line parameters
// argv - the parameters
// Outputs : 0 if successful test, -1 if failure

// Function : ???
// ???

int main(int argc, char *argv[]) {

// Local variables
// NOTE: this is where you will want to add some new variables
int int_array1[10], int_array2[10];
unsigned int uint_array1[10];
int i;
//
if (argc < 11)
{
printf("Exiting the program, missing input");
return 0;
}
// Step a - read in the integer numbers to process
for (i=1; i<11; i++) {
int_array1[i-1] = atoi(argv[i]);//converting input to integer
}

// Step b - Convert numbers into positive values by taking their
// absolute values and save them in int_array2.

// Print all numbers in a single line using display_array function
//

// Step c - Convert these positive integers to numbers
// in the range 0,…,128 by implementing the mod operation
// save them back into int_array2.
// Print all numbers in a single line using display_array function
//

// Step d - for each integer in int_array2 print:
// number, number of 1 bits, even or odd
//

// Step e - Cast each element of int_array2 to unsigned short
// and store them into uint_array1.
//

// Step f - Reverse the order of array elements in uint_array1
// using swap_int function.

/*swap_ints(): function should swap the numbers without using
temp variable*/

// Step g - Update each element of uint_array1 by using reverseBits function.

/* reverseBit(): The function should return the number (in
integer format) whose bits are reversed,
i. e., the top bit of the original number is
the bottom bit of the returned number, the
second from the top bit of the original
number is the second to the bottom bit of
the returned number. */

// Step h - Print each element of uint_array1 in a separate line along with
// binary representation of each of the numbers using binaryString function.

/* binaryString():This function should fill the text string
with a binary representation of the number
suitable for printing. You should be using
some bitwise operations to achieve this,
maybe shifting(<<) and and (&)
operation

*/

// Return successfully
return(0);
}

ansver
Answers: 3

Another question on Computers and Technology

question
Computers and Technology, 21.06.2019 20:30
What important technology has done the most to allow a businesses a chance to compete with larger international companies
Answers: 1
question
Computers and Technology, 23.06.2019 01:00
Petrică, tânăr licean în clasa a ix-a, a primit în dar de la părinţii săi un cont bancar pentru micile sale cheltuieli curente. el este pasionat de internet banking şi îşi verifică cu grijă toate tranzacţiile efectuate. pentru creşterea securităţii tranzacţiilor online, banca îi furnizează lui petrică un număr pe care el va trebui să îl modifice, obţinând un număr tan – număr de autentificare a tranzacţiei (transaction authentication number). regula de obţinere a numărului tan este următoarea: se formează cel mai mic număr par din toate cifrele numărului furnizat de bancă. cerinţă cunoscând numărul n furnizat de bancă, să se determine numărul tan obţinut de petrică. date de intrare fişierul tan.in conţine pe prima linie numărul natural n cu semnificaţia din enunţ. date de ieşire fişierul de ieşire tan.out va conţine o singură linie pe care va fi scris numărul tan cerut. restricţii • 0 < n < 18*1018 • n are cel puţin o cifră pară • numărul tan obţinut nu poate conţine zerouri nesemnificative
Answers: 2
question
Computers and Technology, 23.06.2019 01:30
In deadlock avoidance using banker’s algorithm, what would be the consequence(s) of: (i) a process declaring its maximum need as maximum possible for each resource. in other words, if a resource a has 5 instances, then each process declares its maximum need as 5. (ii) a process declaring its minimum needs as maximum needs. for example, a process may need 2-5 instances of resource a. but it declares its maximum need as 2.
Answers: 3
question
Computers and Technology, 23.06.2019 06:30
On early television stations, what typically filled the screen from around 11pm until 6am? test dummies test patterns tests testing colors
Answers: 1
You know the right answer?
Complete the commented parts in the code below:

#include
#include
#include...
Questions
question
Chemistry, 15.01.2020 02:31
question
Social Studies, 15.01.2020 02:31
question
Mathematics, 15.01.2020 02:31
question
Social Studies, 15.01.2020 02:31
Questions on the website: 13722363