The only syntax error I saw was that the re pattern should have been double quoted.
Other
non-syntax errors are: the import statement doesn't have a valid module
name. It should be "import re" . Since tutorGroup is double quoted in
the re.match(), it becomes a string, not the variable from the input()
function.
Answer:
The following fix were made to the program
- Change void main() to int main(), then set a return value at the end of the main function; e.g. return 0
- Remove system("pause"); It's not needed
- For each of the array, change their lengths to 5 i.e. int votes[5]; string name[5]; and float percent[5];
- Lastly, calculate the percentage using: percent[i]=((votes[i]*100.0/total))
Explanation:
(1) void main implies that the main function will not return any value. So, you change it to int main() and then set the return value
(2) There is no need to pause the program, so system.("pause") is not necessary.
(3) The question says there are 5 candidates. So, we set the arrays to accommodate inputs for 5 values
(4) percent array is declared as float; 100.0 will ensure that it calculates the percentage as a float value.
<em>See attachment for updated code</em>
F this is not related to math I’d pick light blue or a teal blue with either white or gold
The "For each" loop can be used to process each element of an array.?