外层套个循环就行啦while( true ){ ........................ getch();}
while(cin>>n) {........}
是不是忘记+头文件#include