주 메모리에서 작업하는 텍스트 편집기를 만들고있는 중입니다. 나는 문자열 라이브러리 나 cstring 라이브러리를 문자열 클래스로 사용할 수 없으며 파일 처리를 사용할 수 없다. 지금 내가 성취해야 할 것은 한 줄에 60 자만 들어 있고 사용자가 입력시 60자를 초과하면 자동으로 다음 줄로 이동해야하며 사용자가 입력하는 동안 줄 번호도 표시해야합니다. 내 코드는 지금 여기 내가 달성하기 위해 무엇을사용자가 특정 문자 수를 초과하면 행이 변경됩니다.
#include <iostream>
using namespace std;
int main()
{
char***files=new char**[50];
char**fileNames=new char*[50];
int fileCount=0;
while (true)
{
int selector=0;
cout<<"MacMAds Notepad"<<endl<<endl;
cout<<"Press 1. To Create a new file"<<endl;
cout<<"Press 2. To View an existing file by giving file name"<<endl;
cout<<"Press 3. To edit an existing file by giving its name"<<endl;
cout<<"Press 4. To copy an existing file to a new file"<<endl;
cout<<"Press 5. To delete an existing file by giving its name"<<endl;
cout<<"Press 6. To view listof all files with the names"<<endl;
cout<<"Press7. To Exit"
cin>>selector;
if (selector==7)
break;
if (selector==1)
{
cout<<"Please enter the name of file: ";
cin>>fileNames[fileCount];
int nLines=0;
cout<<"Please enter the number of lines for "<<fileNames[fileCount]<<": ";
cin>>nLines;
files[fileCount]=new char*[nLines];
for (int i=0;i<nLines;i++)
{
files[fileCount][i]=new char[61];
cin.getline(files[fileCount][i],60)
}
}
}
return 0;
}
해당 코드는 작성하지 않습니다. 그것을 스스로 시험해보십시오. 그리고 우리는 당신이 마주 치는 특정 문제에 대한 도움을 줄 수 있습니다. –
실제로 실제로 어떤 라이브러리와 함수가이를 달성 할 수 있는지 알고 싶습니다. cin.getline은 이것을 달성 할 것입니다 –
이들 중 어느 것도 사용하지 못하도록 제한되어 있습니까? 나는 네가 원하는 것을 얻지 못한다. –