#include<iostream> using namespace std; char testprog[100]; int main() { char ch; cout<<"please input test program:"<<endl; ch=getchar(); int i=0; while(ch!='#'&&i<100) { testprog[i++]=ch; ch=getchar(); } for(int j=0;j<sizeof(testprog)/sizeof(testprog[0]);j++)//C++中求数组长度 cout<<testprog[j]; }