這裡有個程序的開頭部分:
#include
#include
#include
#include
using namespace std;
int main()
{ int len;
cout << "請輸入長度" << endl;
cin>>len;
int lenword,j,i;
char *essay = new char[len+1];
char *pun= new char[4];
char* useless=new char[4];
char**word;
cout<<"請輸入敏感字符個數";
cin>>lenword;
cin.ignore(INT_MAX,'\n');
cout <<"請輸入三個標點" ;
for( i=0;i
{cin>>pun[i];}
cin.ignore(INT_MAX,'\n');
cout<<"請輸入三個無用字符";
for (i=0;i
{
cin>>useless[i];
}
word=new char*[lenword];
for(i=0;i<lenword;i++)
{word[i]=new char[len+1];
memset(word[i],0,(len+1));
}
cin.ignore(INT_MAX,'\n');
cout<<"請輸入敏感字符並以空格間隔";
for(i=0;i
{cin>>*word[i];}
for(i=0;i<lenword;i++)
cout<<*word[i];
cout<<"請輸入文章";
cin.ignore(INT_MAX,'\n');
for(i=0;i<len;i++)
essay[i]=cin.get();
//長度的判斷
i=0;
while(essay[i]!='\0')
{
i++;
}
{cout<
if (i>len+1)
{cout<<"輸入不符合要求";
return 0;}
}
我有個問題是:比如我輸入了 len=9 為什麼 i 輸出時候是12
???
樓主請上傳代碼圖。。。這個我復制過去不能用,又不能猜測去改