User Tools

Site Tools


c_puzzles

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revision Previous revision
Last revision Both sides next revision
c_puzzles [2015/03/09 10:54]
viennastar [Puzzle B]
c_puzzles [2015/03/09 11:01]
viennastar
Line 5: Line 5:
 ==== Puzzle A ==== ==== Puzzle A ====
  
-Write a C program that uses a function to populate a dynamic one-dimensional array with random floating-point numbers. Allocate the array in the main method, and forward it to the function. Print the content of the array to the terminal in the main method after the function call. Implement the main method and the function in different source files. Use a dedicated header file to provide the function declaration. Provide a Makefile to build and to clean the program. Implement reasonable default values so that no additional user interaction is required to successfully execute the program. ​+Write a C program that uses a function to populate a dynamic one-dimensional array with random floating-point numbers. Allocate the array in the main method, and forward it to the function. Print the content of the array to the terminal in the main method after the function call. Implement the main method and the function in different source files. Use a dedicated header file to provide the function declaration. Provide a Makefile to build and to clean the program. Implement reasonable default values so that no additional user interaction is required to successfully execute the program. Document your code.
  
 **Expected Submission files:** 2 source files, 1 header filer, 1 Makefile **Expected Submission files:** 2 source files, 1 header filer, 1 Makefile
Line 11: Line 11:
 ==== Puzzle B ==== ==== Puzzle B ====
  
-Implement a structure which can hold a simple particle. The structure shall store two spatial integer coordinates (describing where the particle is located in a two-dimensional space) as well a floating-point quantity value for a particle. Implement a program which generates a dynamically sized set of particles and initializes it reasonably: the particles shall be evenly distributed in a 10x10 domain, i.e., 0≤x<10 and 0≤y<​10,​ and assign random floating-point numbers (in the interval [0,1]) to each particle'​s quantity value. Write the set of initialized particles to a CSV output file - for each particle write the line in this format: x-position y-position quantity-value. The output file ending shall be '​*.csv'​. Also, provide a Makefile to build and clean the program. ​+Implement a structure which can hold a simple particle. The structure shall store two spatial integer coordinates (describing where the particle is located in a two-dimensional space) as well a floating-point quantity value for a particle. Implement a program which generates a dynamically sized set of particles and initializes it reasonably: the particles shall be evenly distributed in a 10x10 domain, i.e., 0≤x<10 and 0≤y<​10,​ and assign random floating-point numbers (in the interval [0,1]) to each particle'​s quantity value. Write the set of initialized particles to a CSV output file - for each particle write the line in this format: x-position y-position quantity-value. The output file ending shall be '​*.csv'​. Also, provide a Makefile to build and clean the program. Document your code.
  
 **Expected Submission files:** 1 source file, 1 Makefile **Expected Submission files:** 1 source file, 1 Makefile
  
c_puzzles.txt · Last modified: 2015/03/09 11:10 by viennastar