okay, I am coding in eclipse because that is what my class requires. I am brand new to coding and comp sci, this is my first class ever. I can't seem to figure out why I keep getting a syntax error message whenever I try to run this program. Maybe someone can point me in the right direction?
//============================================================================
// Name : A4Q1.cpp
// Author :
// Version :
// Copyright : Your copyright notice
// Description : Hello World in C++, Ansi-style
//============================================================================
#include <iostream>
using namespace std;
int dayOfWeek(int day, int month, int year){
year=year-((14-month)/12);
year=year+(year/4)-(year/100)+(year/400);
month=month+12*((14-month)/12)-2;
day=(day+year+((31*month)/12))%7;
return day;
}
/*void displayName(int day, string day1){
if (day == 0)
{
cout << " That date was a Sunday ";
}
else if ( day == 1)
{
cout << " That date was a Monday ";
}
else if ( day == 2 )
{
cout << " That date was a Tuesday ";
}
else if (day == 3)
{
cout << " That date was a Wednesday ";
}
else if ( day == 4)
{
cout << " That date was a Thursday ";
}
else if ( day == 5 )
{
cout << " That date was a Friday ";
}
else if (day == 6)
{
cout << " That date was a Saturday ";
}*/
int main(){
int day;
int month;
int year;
cout << "enter day, month, year:" << endl;
cin >> day >> month >> year;
day = dayOfWeek(day, month, year);
}
The part that is giving me trouble is the underlined part. I keep getting an error saying "syntax error" but I can't see where. I am aware that the function "displayName" is in a comment. I didnt want it to mess with anything, just in case. I also am wondering how to call the void function into the main program. The idea of the program is to put out a number for each day of the week (0=sunday, 1=monday...6=saturday)and then take the number and assign the name of the day to it instead of just displaying the numbers 0-6. so, so far the program would output an integer from 0-6. Im just wondering where to go from there. Thank you for your help!
P.s I am sorry if I didn't make sense. I've had a VERY long day! Thank you!
It is customary when posting about an error to share the entire error, since it very often is more helpful when figuring out the problem than "syntax error." Also, use code tags. Look for the <> button.
Thanks for the help everyone. Eclipse seems to be kind of buggy for mos people in the class and simply copy and pasting it into another project seems to help. I feel dumb now that it was so simple! But thanks everyone none the less!