c++读取txt出现redeclaration of 'std::ifstream fin'和'std::ifstream fin' previously declared here
代码内容:#include<iostream>#include<fstream>#include<assert.h>#include<windows.h>usingnam...
代码内容:
#include<iostream>
#include<fstream>
#include<assert.h>
#include<windows.h>
using namespace std;
int main()
{
double a;
double b;
double c;
system("dir \\\Rick\\R.G.O.S.Download /A:D /B >update.txt");
ifstream fin("\\\Rick\\R.G.O.S.Download\\update.txt");
while(!fin.eof())
{
fin>>a;
fin.close();
}
ifstream fin("update.txt");
fin>>b;
fin.close();
c=b-10*a+30;
if (c>=0)
{
system("del update.txt /Q /F");
ofstream fout("update.txt");
fout<<c;
fout.close();
system("start update.bat");
}
} 展开
#include<iostream>
#include<fstream>
#include<assert.h>
#include<windows.h>
using namespace std;
int main()
{
double a;
double b;
double c;
system("dir \\\Rick\\R.G.O.S.Download /A:D /B >update.txt");
ifstream fin("\\\Rick\\R.G.O.S.Download\\update.txt");
while(!fin.eof())
{
fin>>a;
fin.close();
}
ifstream fin("update.txt");
fin>>b;
fin.close();
c=b-10*a+30;
if (c>=0)
{
system("del update.txt /Q /F");
ofstream fout("update.txt");
fout<<c;
fout.close();
system("start update.bat");
}
} 展开
1个回答
推荐于2016-11-11
展开全部
#include<iostream>
#include<fstream>
#include<assert.h>
#include<windows.h>
using namespace std;
int main()
{
double a;
double b;
double c;
system("dir \\\Rick\\R.G.O.S.Download /A:D /B >update.txt");
{ //这里
ifstream fin("\\\Rick\\R.G.O.S.Download\\update.txt");
while(!fin.eof())
{
fin>>a;
fin.close();
}
} //这里
{ //这里
ifstream fin("update.txt");
fin>>b;
fin.close();
c=b-10*a+30;
if (c>=0)
{
system("del update.txt /Q /F");
ofstream fout("update.txt");
fout<<c;
fout.close();
system("start update.bat");
}
} //这里
}
已修改
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询