/////////소스 전체 입니다.
// 소스 안에 주석으로 질문의 요지를 적었습니다.
#include <IOSTREAM>
using namespace std;
#include <FSTREAM>// 파일 스트림
using std::ifstream; // 입력 파일 스트림
using std::ofstream; // 출력 파일 스트림
int main()
{
int a;
int account;
char name[ 30 ];
double balance;
cin>>a;
cout<
ofstream outClientFile( \"input.dat\", ios::out );
if ( !outClientFile ) // 파일을 생성할 수 없으면 프로그램을 종료한다. 오버로딩 ! 연산자
{
cerr << \"File could not be opened\" << endl;
exit( 1 );
}
while ( cin >> account >> name >> balance )
{
outClientFile << account << \' \' << name << \' \' << balance << endl; //빈칸으로 각 항목들 구분해준다.
cout << \"? \";
}
cin>>a;
cout< cout<<\"파일 생성\";
ifstream inClientFile( \"input.dat\", ios::in );
if ( !inClientFile )
{
cerr << \"File could not be opened\" << endl;
exit( 1 );
}
/////////////////질문 입니다.////////////////////////////////////////////////////////////////////////
cin>>a; //////////////////////////////이게 왜 작동되지 않는 건가요???
// 위에 while ( cin >> account >> name >> balance ) 이게 추가 되면서 부터 파일을 열고나서 cin 이 작동을
// 안하는데 왜 그런건가요?ㅠㅠ
/////////////////질문 입니다.////////////////////////////////////////////////////
cout<<\"오류감지\"< cout << \"파일 열었다\";
return 0;
}<<<</FSTREAM></IOSTREAM>
// 소스 안에 주석으로 질문의 요지를 적었습니다.
#include <IOSTREAM>
using namespace std;
#include <FSTREAM>// 파일 스트림
using std::ifstream; // 입력 파일 스트림
using std::ofstream; // 출력 파일 스트림
int main()
{
int a;
int account;
char name[ 30 ];
double balance;
cin>>a;
cout<
ofstream outClientFile( \"input.dat\", ios::out );
if ( !outClientFile ) // 파일을 생성할 수 없으면 프로그램을 종료한다. 오버로딩 ! 연산자
{
cerr << \"File could not be opened\" << endl;
exit( 1 );
}
while ( cin >> account >> name >> balance )
{
outClientFile << account << \' \' << name << \' \' << balance << endl; //빈칸으로 각 항목들 구분해준다.
cout << \"? \";
}
cin>>a;
cout< cout<<\"파일 생성\";
ifstream inClientFile( \"input.dat\", ios::in );
if ( !inClientFile )
{
cerr << \"File could not be opened\" << endl;
exit( 1 );
}
/////////////////질문 입니다.////////////////////////////////////////////////////////////////////////
cin>>a; //////////////////////////////이게 왜 작동되지 않는 건가요???
// 위에 while ( cin >> account >> name >> balance ) 이게 추가 되면서 부터 파일을 열고나서 cin 이 작동을
// 안하는데 왜 그런건가요?ㅠㅠ
/////////////////질문 입니다.////////////////////////////////////////////////////
cout<<\"오류감지\"< cout << \"파일 열었다\";
return 0;
}<<<</FSTREAM></IOSTREAM>
출력스트림은 쓰는데 입력스트림은 왜 안씀
아 죄송해요 저기에 cout << a; 해도.. 그냥 cin>>a; 자체가 무시되던데.ㅠㅠ