I'm programming a simple program that generates a report of some data into the file. The final file so far looks like this:
Date: Mon Oct 09 16:33:09 2017
LENOVO-KOMPUTER
+------+----------+-------+------+
| ID | name | temp. | poj. |
+------+----------+-------+------+
|000000|hejka | 1.5| 0|
|000001|naklejka | 31.8| 1|
|000002|dupa | 0.0| 2|
|000003|proba | 0.0| 3|
|000004|cos | 0.0| 4|
|000005|nic | 0.0| 5|
|000006|polewamy | 0.0| 6|
|000007|sie | 0.0| 7|
|000008|szampanem | 0.0| 8|
|000009|ojojoj | 0.0| 9|
+------+----------+-------+------+
| | | | |
+------+----------+-------+------+
In the blank spaces at the bottom I have to sum up the whole column above. I need to use overloaded += operator to sum a column up (one has to work for all of them), but second one needs to stay clean, cause there is only text there (it needs to stay clear after using that += operator thing on it).
How do I determine whether I can sum up the values (cause they're numbers) or I can't (cause it's text)? I think it needs to be some kind of "if statement" at the beginning but I can't find anything that'd work.
Aucun commentaire:
Enregistrer un commentaire