无论我编再简单的程序只要有fstream,就会有'void __thiscall std::basic_ifstream >::open(const char *,int)' : cannot convert parameter 1 from 'const char *(void) const' to 'const char *'
There is no context in which this conversion is possible这个错误;求助为什么?
#include
#include
#include
using namespace std;
int main()
{
string filename;
string destination;
char i,r;
ifstream inData;
ofstream outData;
cout<<"please enter the filename and the destination:"< cin>>filename>>destination;
inData.open(filename.c_str);
outData.open(destination.c_str);
if(!inData||!outData)
{
cout<<"can't open the file"< return 1;
}
inData.get(i);
r=i+3;
return 0;
}
--------------------next---------------------
//这个程序是将二进制数字转化为十进制数字
#include//for cin and cout
#include//for ifstream and ofstream
#include//for pow function
#include//for filename
using namespace std;
void printline();//print the headline
void change();//change the digits
int main()
{
printline();
change();
return 0;
}
//***********************************************************************
void change()
{
//change digits
string filename;
ifstream indata;
//open the file
indata.open(filename.c_str());
cout<<"please enter the filename";
cin>>filename;
if(!indata)
{
cout<<"can't open the file"; //check the file
}
else
{
string line;
indata>>line; //整行地读入
string::size_type n;
n=line.length();//一行有多少个数字方便乘以二的几次方
int count1=1;
int count2=1;
int count3=0;
while(count1<=n&&count2<=n)
{
int j,b;
b=substr((0+count3),1);//take the digit one by one
j=b*pow(2,n-count2);
cout<
int c=1;
while(c<=(14-n))
{
cout<<" ";
c++;
}
cout< }
count3++;
}
}
//*******************************************************************************************
void printline()
{
// print the title
cout<<"Binary Number Decimal Equivalent"< }
--------------------next---------------------
阅读(1101) | 评论(0) | 转发(0) |