#include <cstdlib>
#include <iostream>
#include <string>
using namespace std;
bool checkleap(int year);
int main(int argc, char *argv[])
{string s1;
int year,month,day,inbetween,dayspassed;
char dash1,dash2;
s1="Today is day number: ";
bool leapcheck;
leapcheck=checkleap(year);
cout<<"Enter a date, in the form of MM-DD-YYYY: "<<endl;
cin>>month>>dash1>>day>>dash2>>year;
switch (month)
{case 1: 31-day=inbetween; //Line 19
31-inbetween=dayspassed; //Line 20
cout<<s1<<dayspassed<<endl;
break;
case 2: if(leapcheck=true)
{60-day=inbetween; //Line 24
60-inbetween=dayspassed; //Line 25
cout<<s1<<dayspassed<<endl;}
else
{59-day=inbetween; //Line 28
59-inbetween=dayspassed; //Line 29
cout<<s1<<dayspassed<<endl;}
break;
case 3: if(leapcheck=true)
{91-day=inbetween; //Line 33
91-inbetween=dayspassed; //Line 34
cout<<s1<<dayspassed<<endl;}
else
{90-day=inbetween; //Line 37
90-inbetween=dayspassed; //Line 38
cout<<s1<<dayspassed<<endl;}
break;
system("PAUSE");
return EXIT_SUCCESS;
}
bool checkleap(int year)
{if(year%4=0 && year%100!=0 || year%100=0 && year%400=0) //Line 47
return true;
return false;} //Line 49
Right, so this is what I have been working on thus far. Basically, I'm trying to display the how many days have passed since the beginning of the year (this is determined via data input from the user). I'm obviously not finished yet. What I wanted to do was quickly compile my program to check for errors; I have several, but most are the same kind of error, namely: non ivalue in assignment. Below are all errors picked up by the compiler:
19 non-lvalue in assignment
20 non-lvalue in assignment
24 non-lvalue in assignment
25 non-lvalue in assignment
28 non-lvalue in assignment
29 non-lvalue in assignment
33 non-lvalue in assignment
34 non-lvalue in assignment
37 non-lvalue in assignment
38 non-lvalue in assignment
47 a function-definition is not allowed here before '{' token
47 expected `,' or `;' before '{' token
49 expected `}' at end of input