#ifndef HEADER1_H_
#define HEADER1_H_
#include <string>
using namespace std;
class rachunekBankowy
{
private:
string nazwisko_;
string numerRachunku_;
double saldoKonta_;
public:
rachunekBankowy(const string & nazwisko, const string & numerRachunku, double saldoKonta = 0.0);
void pokaz();
void przyjmowanie(double saldoKonta);
void wydawanie(double saldoKonta);
};
#endif
#include "stdafx.h"
#include "Header1.h"
#include <iostream>
using namespace std;
rachunekBankowy::rachunekBankowy(const string & nazwisko, const string & numerRachunku, double saldoKonta)
{
nazwisko_ = nazwisko;
numerRachunku_ = numerRachunku;
saldoKonta_ = saldoKonta;
}
void rachunekBankowy::pokaz()
{
cout << "Nazwisko: " << nazwisko_ << endl;
cout < "Numer rachunku: " << numerRachunku_ << endl;
cout << "Saldo konta: " << saldoKonta_ << endl;
}
void rachunekBankowy::przyjmowanie(double saldoKonta)
{
saldoKonta_ += saldoKonta;
}
void rachunekBankowy::wydawanie(double saldoKonta)
{
saldoKonta_ -= saldoKonta;
}
#include "stdafx.h"
#include "Header1.h"
#include <iostream>
using namespace std;
int main()
{
rachunekBankowy pierwszy("Murzyn","123", 2.3);
pierwszy.pokaz();
return 0;
}
Błąd wyskakuje w pliku drugim w funkcji
void rachunekBankowy::pokaz()
w tej linii
cout < "Numer rachunku: " << numerRachunku_ << endl;
treść błędu :
Error C2784 'std::basic_ostream<_Elem,_Traits> &std::operator <<(std::basic_ostream<_Elem,_Traits> &,const std::basic_string<_Elem,_Traits,_Alloc> &)': could not deduce template argument for 'std::basic_ostream<_Elem,_Traits> &' from 'const char [17]'
oraz
Error C2677 binary '<<': no global operator found which takes type 'std::string' (or there is no acceptable conversion)
z góry dzięki za pomoc