I've been trying for hours to use vectors and storing the digits and operators in the vector to see if i can then use srand to randomly insert the operators but I'm just stuck.
Suppose we have digits 1 2 3 4 5 6 7 8 9 and arithmetic operators +, -, and *.
Write a programme that finds a formula that evaluates to 100 by inserting operators between the sequence of digits.
The following is a sample output:
12-3+4+5*6-7+8-9 = 100
Aucun commentaire:
Enregistrer un commentaire