I have a homework assignment to create a program to calculate the full date of Easter Sunday between the years 1900 and 2600. The following is the error I receive:

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 'std::basic_istream<_Elem,_Traits>'

My professor checked my code and said that it was fine; however, even with cleaning the solution, I can't run the program. So, what exactly does the above error mean, and how would I go about fixing the code?

#include <iostream>
#include <iomanip>
using namespace std;
int main () {

	int a, b, c, d, e;
	int day, year;

	cout << "Easter Sunday Calculator" << endl;
	cout << "Enter the year: ";
	cin >> year << endl;
	cout << "Easter Sunday is "; 

	//this calculation formula works only for the certain range of 
	//year values.
	if (year <1900 || year >2600) { 
		cout << "This calculator cannot serve you\n";
	return -1; //terminate the program. 
	}
	
	a = year % 19;
	b = year % 4;
	c = year % 7;
	d = (19 * a + 24) % 30;
	e = (2 * b + 4 * c + 6 * d + 5) % 7;
	day = 22 + d + e;

	if (day > 31) {
		cout << "April ";
		day = d + e - 9;
		if (year == 1954 || year == 1981 || year == 2049 || year == 2076) {
			day = d + e - 16; 
		}
	}
	else {
		cout << "March ";
	}
	
	cout << day << ", " << year << endl;

	return 0;
}

It means get rid of this unnecessary bit:

cin >> year << endl;

I spent so much time trying to figure it out, and to think it was something that easy. That little mistake went right past my prof. Thank you so much.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.