Guest User

Untitled

a guest
Dec 17th, 2018
70
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.49 KB | None | 0 0
  1. import subprocess
  2. import os
  3.  
  4. for file in os.listdir():
  5. if file.endswith(".c"):
  6. cmd = os.path.join(file)
  7. resultFile = cmd[:-2] + ".txt"
  8. subprocess.run(["gcc",cmd]) #For Compiling
  9. os.system("./a.out > " + resultFile)
  10. mark = subprocess.run(["cmp", resultFile, "solution.txt"])
  11. os.remove(resultFile)
  12. mark = mark.returncode
  13. if (mark == 0):
  14. print(cmd[:-2] + " Mark: 100%")
  15. else:
  16. print(cmd[:-2] + " Mark: 0.0%")
Add Comment
Please, Sign In to add comment