Chapter 09 - File Streams - Challenges

Stars

Create a file with the following content:

*
**
*
********
*
*******
***
****
**

Create an application that reads the file line by line and counts the stars in each line. Output the results to the terminal for each line and also output the grand total of stars in the file.

Determinant of Matrix

Create a file with the following content:

6 1 1
4 -2 5
2 8 7

Create an application that reads a square matrix from a file (dimensions undetermined) and calculates the determinant from that matrix. The result is outputted to another file after the matrix.

Use the output example below to reconstruct the required format:

[6 1 1]
[4 -2 5]
[2 8 7]

D = -306

Make sure to test your application with another matrix or a matrix with a bigger dimension.

results matching ""

    No results matching ""