All code must compile without errors or warnings to receive credit. Makesure you are compiling with the-Wallflag.1. Write a program that accepts a file name and a numbernfrom the command line.The...

All code must compile without errors or warnings to receive credit. Makesure you are compiling with the-Wallflag.1. Write a program that accepts a file name and a numbernfrom the command line.The program should open the file as a binary file and count the number of times itreads a bit sequence withnconsecutive bits with value 1.For example, consider the 8-bit sequence10110110. If the user enters 2, yourprogram should output 2 since there are to groups of 2 consecutive bits with value1.Requirements(a) Check that the file exists before reading data from it.(b) Close the file before exiting the program.(c) Use a separate function to count the number of time a sequence ofn1s areread.(d) Read a single byte from the file at a time.(e) Properly format your code using a standard indentation style.(f) Save your code asbit_sequence.c.2. Create a header file which defines the following vector types:•vec2f- An array of 2floatvalues.•vec3f- An array of 3floatvalues.•vec4f- An array of 4floatvalues.Additionally, include function declarations for vector addition and scalar multipli-cation. Vector addition is defined asa+b=∑iai+biand scalar multiplication isdefined asca= [ca1ca2. . . can].In a corresponding C file, implement the definition for the functions declared in theheader file. Inmain, test each function using sample input of your choice. The inputcan be hard-coded. Clearly print the results of each test, showing the input valuesof each vector used.Requirements(a) Declare the types and functions in the header file as requested.(b) The header file must include a header guard.CSE 1320: Assignment 3Dillhoff(c) Implement the function definitions and tests as requested in the C file.(d) Properly format your code using a standard indentation style.(e) Save your code asvector_types.handvectors_types.c.Example OutputFor vec2f...[2, 4] + [8, 6] = [10, 10]3 * [2, 4] = [6, 12]...3. Create a program that reads in both binary and CSV versions of product data. Theprogram should additionally print out the data as shown in the example output.Your program should accept the filename as a command line argument. First, checkthe extension of the filename. If it is CSV data, attempt to parse the file. Be sureto check for any errors that may occur while reading the data. For example, eachline of CSV must include the 4 attributes as defined below.For binary data, first check that the first 4 bytes of the file match the signatureCSEP. If so, the remaining data will be binary data of thestructdefined below.Data Format•ID -int•Name -char [128]•Price -double•Quantity -intRequirements(a) Implement thestructdefinition in a header file.(b) Additionally, all functions must be declared in the header file.(c) The header file must include a header guard.(d) File pointers must be checked after opening.(e) File pointers must be closed before your program exits.(f) Define the functions as requested.(g) The program must take a filename as input from the command line.(h) Properly format your code using a standard indentation style.(i) Save your code aslist_products.handlist_products.c.Example Output$ ./a.out prices.csvID NAME PRICE QTY-----------------------------------------1000 Intel Core i7-10700K $399.99 101001 Intel Core i7-9700K $479.98 5
Sep 29, 2021
SOLUTION.PDF

Get Answer To This Question

Related Questions & Answers

More Questions »

Submit New Assignment

Copy and Paste Your Assignment Here