个人笔记,半公开
利用脚本
Windows
:Loop
1g.exe
1s.exe
1.exe
fc 1.out 1.ans
if %errorlevel% == 0 goto Loop
pause
Linux
#!/bin/bash
tester="diff "$1".out "$1".ans -w"
runstu="./"$1
runstd="./"$1"s"
rungen="./"$1"g"
num=1
while :
do
regen=$("$rungen")
restu=$("$runstu")
restd=$("$runstd")
ans=$($tester)
if [ $ans ]
then
echo "$ans"
break
fi
echo "$ans"
echo "win for $num times. You are so great. "
num=`expr $num + 1`
done
利用c++
利用system函数
直接利用system("fc 1.out 1.ans")之类的东西。Linux和Windows都能用
tip:Windows用fc,Linux用diff(最后要加一个-w)
利用struct/class
把所有东西放到一个程序里面,开三个class。Linux和Windows都能用。