سورس کد پروژه محاسبه هر روز از هفته به زبان سی پلاس پلاس
در این پست سورس کد پروژه محاسبه هر روز از هفته به زبان سی پلاس پلاس را برایتان آماده کرده ایم که می توانید براحتی دانلود و پروژه را اجرا نمایید.توجه داشته باشید که می توانید به وسیله این پروژه هر روز از هفته را محاسبه نمایید.بعلاوه می توانید سورس کد کار با آرایه به زبان سی پلاس پلاس را نیز از سایت ما دانلود نمایید.
#include <iostream> #include <cmath> // for floor() #include <conio.h> // for getch() #include <stdlib.h> // for exit() #include <windows.h> // for system() using std::cout; using std::cin; //======================= void Menu( void ); int main( void ) { Menu(); return 0; }// End of main function //======================= void Menu( void ) { int year, month, day; int week; int century; int temp; bool flag= false; system( "cls" ); cout<< "\n\n =========== Calculate any day of the week =========== "; cout<< "\n\n\t\t Enter year month day: "; cin>> year>> month>> day; temp= year; if( year<= 1582 && month<= 10 && day<= 15 ) { flag= true; } if( month== 2 || month== 1 ) { year--; month= 12+ month; } century= year/ 100; year= year% 100; // The last two digits of the year if( flag== false ) { week= year+ ( int )floor( ( double )year/ 4 )+ ( int )floor( ( double )century/ 4 )- 2* century+ ( int )floor( (double ) 26*( month+ 1 )/ 10 )+ day- 1; } else { week= year+ ( int )floor( ( double )year/ 4 )+ ( int )floor( ( double )century/ 4 )- 2* century+ ( int )floor( ( double ) 26*( month+ 1 )/ 10 )+ day- 3; } week= ( week% 7+ 7 )% 7; year= temp; switch( week ) { case 0: { cout<< "\n\n\t\t "; cout<< year<< "-"<< month<< "-"<< day<< ": "<< "Sunday"; break; } case 1: { cout<< "\n\n\t\t "; cout<< year<< "-"<< month<< "-"<< day<< ": "<< "Monday"; break; } case 2: { cout<< "\n\n\t\t "; cout<< year<< "-"<< month<< "-"<< day<< ": "<< "Tuesday"; break; } case 3: { cout<< "\n\n\t\t "; cout<< year<< "-"<< month<< "-"<< day<< ": "<< "Wednesday"; break; } case 4: { cout<< "\n\n\t\t "; cout<< year<< "-"<< month<< "-"<< day<< ": "<< "Thursday"; break; } case 5: { cout<< "\n\n\t\t "; cout<< year<< "-"<< month<< "-"<< day<< ": "<< "Friday"; break; } case 6: { cout<< "\n\n\t\t "; cout<< year<< "-"<< month<< "-"<< day<< ": "<< "Saturday"; break; } } cout<< "\n\n\t\t Do you want to continue( Y/N ): "; char letter; cin>>letter; if( toupper( letter)== 'Y' ) { Menu(); } else { cout<< "\n\n\t\t Thank U."; getch(); exit( 1 ); } }// End of Menu function
دیدگاه کاربران
تعداد دیدگاه های کاربران : ۰ دیدگاه