| | |
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++
Views: 2219 | Replies: 3
| Thread Tools | Search this Thread |
Tag cloud for C++
6 api array arrays based beginner binary bmp c++ c/c++ calculator char class classes code compile compiler console conversion convert count data delete deploy dll download dynamic dynamiccharacterarray encryption error file format forms fstream function functions game givemetehcodez graph gui homeworkhelp iamthwee ifstream input int java lib library lines linker list loop looping loops map math matrix memory newbie news number output pointer problem program programming project python random read recursion recursive reference return rpg search simple sort spoonfeeding string strings struct temperature template templates text text-file tree url variable vector video visual visualstudio void win32 windows winsock wordfrequency wxwidgets






