| | |
function to check leap year
Please support our C++ advertiser: Intel Parallel Studio Home
![]() |
•
•
Join Date: Oct 2008
Posts: 16
Reputation:
Solved Threads: 0
C++ Syntax (Toggle Plain Text)
//checks for leap year bool checkLeapYr(int year) { bool isLeap; if ((year%4=0) && (year %100!=0) || (year%400=0)) //error here. Non-Ivalue assignment { isLeap=true; return isLeap; } else { isLeap=false; return isLeap; } }//end function check leap year
i have the above function to check if a year is a leap year. The if statement is giving me a compilation error message "non-lvalue in assignment". Can anyone help me with it please?
Thank you.
Keep it simpler, it's C++, not Pascal
:
: C++ Syntax (Toggle Plain Text)
//checks for leap year bool checkLeapYr(int year) { return year%4 == 0 && (year %100 != 0 || year%400 == 0); }//end function check leap year//checks for leap year
Last edited by ArkM; Nov 12th, 2008 at 9:42 am.
![]() |
Similar Threads
- leap year program (C++)
- function passing variables (C)
- Logic to Convert Days From 1800 to a Date (Month, Day, Year) (C++)
Other Threads in the C++ Forum
- Previous Thread: Need insight in assignment
- Next Thread: Link Loki to app in Visual C++
| Thread Tools | Search this Thread |
api array based beginner binary bitmap c++ c/c++ calculator char char* class code coding compile compiler console conversion count data database delete deploy developer dll download dynamic dynamiccharacterarray email encryption error file forms fstream function functions game getline givemetehcodez graph gui homeworkhelp homeworkhelper iamthwee ifstream input int integer java lib linker list loop looping loops map math matrix memory multiple news node number numbertoword output parameter pointer problem program programming project proxy python random read recursion recursive reference rpg sorting string strings struct temperature template text text-file tree url variable vector video visual visualstudio win32 windows winsock word wordfrequency wxwidgets






