| 1 5 3 8 2 3 1 3 5 6 5 2 4 2 1 1 4 3 0 0 |
|
|
ifstream is probably an std::ifstream. You also need to open the file that you want to read from. You can do that on the same line e.g. std::ifstream inFile("file_name.txt");, or you can do it after initialization e.g. inFile.open("file_name.txt");.int team[5] = {}; is enough.if (1 <= teamNum <= 5).inFile.close(); when you are finished with the file stream. Output to a file works in a similar way. http://www.cplusplus.com/reference/iostream/ofstream/
| IceThatJaw wrote: |
|---|
int team[5] = {0}; //I'm not sure if this syntax is correct |
| monad wrote: |
|---|
Line 10 should be if (1 <= teamNum <= 5) |
if (teamNum >= 1 && teamNum <= 5).
| monad wrote: |
|---|
| Why? I admit that I've never used the former over the latter, but it works does it not? Off topic, but what is the syntax for quotes within posts? |
|
|
while (1 <= i <= 10) would be the same aswhile ( (1 <= i) <= 10 ) in which case 10 would be compared against a boolean, but based on your results that wouldn't be correct either.| Moeljbcp wrote: |
|---|
| As for how quotes work: [quote=PersonName]Thing they said goes here[ /quote] |
|
|
(1 <= i <= 10) interpreted like this ((1 <= i) <= 10)?(1 <= 10) or ( 0 <= 10).