I am having trouble with printing a string in C++.
I know there are lots of topics about this matter on SO, but most say to include <string>
, <iostream>
or namespace std
. But I did all of that but still encounter the issue. Here is my code and the error.
#include <iostream>
#include <string>
using namespace std;
//...
void affiche_date(int annee, int nbjours) {
string mois;
if (nbjours>31) {
mois = "avril";
nbjours -= 31;
} else {
mois = "avril";
}
cout << "Date de Paques en " << annee << " : " << nbjours << " " << mois << end;
}
int main() {
int annee ( demander_annee() ) ;
int jour ( date_paques(annee) );
affiche_date(annee, jour);
}
Here is the error I get when I compile:
"error: no match for ‘operator<<’ (operand types are ‘std::basic_ostream<char>’ and ‘<unresolved overloaded function type>’)"
This error is coming from the line with the cout in the function I gave you.
I am using Geany on linux Ubuntu and using c++11.
Thanks for you help