错误 C2784: 'std::basic_ostream<_Elem,_Traits> &std::operator <<(std::basic_ostream<_Elem,_Traits> &,const std::basic_string<_Elem,_Traits,_Alloc> &)' : >不能从 >'std::string' c:\documents and settings\rcs\my documents\visual studio 2010\projects 推导出 'std::basic_ostream<_Elem,_Traits> &' 的模板参数...
代码是:
#include <iostream>
#include <fstream>
#include <sstream>
#include <string>
#include "Pacient.h"
using namespace std;
void ruajKartele(Pacient patient)
{
int mosha;
char gjinia;
string foo=patient.getEmer();
string skedar=foo;
ofstream file;
file.open(skedar, ios::app);
skedar<<foo+"\n";
mosha=patient.getMosha();
gjinia=patient.getGjinia();
foo=patient.getDiagnoza();
skedar<<mosha<<"\n"<<gjinia<<"\n"<<foo<<"\n";
foo=patient.getPrognoza();
skedar<<foo+"\n";
skedar<<"-----\n"; //5
skedar.close();
}
int _tmain(int argc, _TCHAR* argv[])
{
return 0;
}
//Pacient structure:
#include <string>
class Pacient
{
protected:
std::string emer;
int mosha;
char gjinia;
std::string diagnoza;
std::string prognoza;
public:
Pacient(void);
~Pacient(void);
void setEmer(std::string);
void setMosha (int);
void setGjinia(char);
void setDiagnoza(std::string);
void setPrognoza(std::string);
std::string getEmer(void);
int getMosha(void);
char getGjinia(void);
std::string getDiagnoza(void);
std::string getPrognoza(void);
};