《经典的求素数的C++程序.docx》由会员分享,可在线阅读,更多相关《经典的求素数的C++程序.docx(2页珍藏版)》请在三一办公上搜索。
1、经典的求素数的C+程序#include using namespace std; int main courhollo,world!endl; return 0; 再接着就是如比较两个数大小的 下面给你一个比较简单的判断某年某月某日是本年的第几天: #include using namespace std; int dayfun (int nowyear,int nowmonth,int nowday) bool isrunnian=(nowyear%4=0)&(nowyear%100!=0)|(nowyear%400=0); int whichday=0; for (int i=1;inow
2、month;i+) switch(i) case 1: case 3: case 5: case 7: case 8: case 10: case 12: whichday+=31;break; case 4: case 6:case 9: case 11: whichday+=30;break; case 2: if(isrunnian=true) whichday+=29;break; else whichday+=28;break; return whichday+nowday; int main int nowyear,nowmonth,nowday,ff=0; cout请输入一个日子:endl; cout nowyear; coutnowmonth; coutnowday; ff=dayfun(nowyear,nowmonth,nowday); coutnowmonth月nowday日是nowyear年的第ff天endl; return 0;