돌겠어~ 너무 돌겠어~
출력은 되는데 읽을수 없다고 또그러네 ㅠ
#include <iostream>
#include <fstream>
#include <string>
using namespace std;
int getLine();
void main()
{
ifstream in(\"data.txt\");
int i;
int count;
int f;
count=getLine();
string* str=new string[count];
for(i=0;!in.eof();i++)
{
getline(in,str[i]);
cout<<str[i]<<endl;
}
cout<<endl;
char world[30];
cout<<\"문자열을 입력하시오\"<<endl;
cin>>world;
for(i=0;i<count;i++)
{
cout<<str[i]<<endl;
f=str[i].find(world);
if(f==-1)
{
cout<<\"문자열 없음\"<<endl;
}
else
{
cout<<\"문자열 |=\"<<f<<endl;
}
cout<<\"-----------------------------------\"<<endl;
}
string sc;
for(i=0;i<count;i++)
{
for(int j=0;j<count;j++)
{
if(str[j-1]>str[j])
{
sc=str[j-1];
str[j-1]=str[j];
str[j]=sc;
}
}
}
for(i=0;i<count;i++)
{
cout<<str[i]<<endl;
}
}
int getLine()
{
ifstream in(\"data.txt\");
string temp;
for(int i=0;!in.eof();i++)
{
getline(in,temp);
}
return i;
}
댓글 0