Dev-C is an integrated development environment (IDE) for the C programming language. It presents a feature-rich environment, tools for writing and debugging, as well as a compiler to provide you with all the tools necessary to program software in C. The program is a fork of the Bloodshed Dev-C environment, designed for advanced programmers looking to create applications from scratch using the low-level language.
Print calendar
To understand this example, you should have the knowledge of following C programming topics: This program takes an arithmetic operator (+, -,., /) and two operands from an user and performs the operation on those two operands depending upon the operator entered by user. In today’s C programming language tutorial we take a look at how to use time and date from C programs. To make use of time and date function you need to include the time.h header file from the standard C library. This header file contains functions and macros that provide standardized access to time and date. C Program to Check Leap Year. C Program to Check Leap Year This program checks whether an year (integer) entered by the user is a leap year or not. To understand this example, you should have the knowledge of the following C programming topics.
#include<iostream>
#include<conio.h> #include<iomanip> using namespace std; void printPascalTr(int size); int getFirstDay(int year,int month); int getDayCode(int year); void printCar(int year,int month); int main() { /* Carlenda writen by: */ int i, year; char ch='y'; while(ch'y'){ cout<<'Enter year of the carlenda:';//year input cin>>year; //print carlenda for the input year for(i=1;i<=12;i++) printCar(year,i); cout<<'Continue? press y:'; cin>>ch; } getch(); return 0; } // calculate the first day of week for current month int getFirstDay(int year,int month){ int fday=getDayCode(year); int num_days=0; // number of days of the year before the current month int dCode=getDayCode(year); switch(month){ case 12: num_days+=30; case 11: num_days+=31; case 10: num_days+=30; case 9: num_days+=31; case 8: num_days+=31; case 7: num_days+=30; case 6: num_days+=31; case 5: num_days+=30; case 4: num_days+=31; case 3: num_days+=28; case 2: num_days+=31; } if(month1) return(fday);else if((year%40) || (year%4000) && month>2) return (num_days+1+dCode)%7 ; // leap year
This is a small sub, so first-timers would be more suited than power-mods. Nwn2 mask of the betrayer cd key generator download. Remember to add keywords if your query is a specific one. It is almost essential that you are experienced with NWN1, NWN2, and NWO, as you will have to enforce spoiler tags.If you want to help out and learn the ropes of moderating, please.Regarding Link Flair:To aid in ease-of-use and save everyone some time, we have link search filters for the community to use. The FR Games CommunityWhat's the fuss all about?Get the Neverwinter Nights games at GOG.com:.Information Links:.Modding Links:.Spoiler Tags:Please add spoiler tags if you're talking about the events of the game. To add a spoiler tag use the appropriate code in your comments:spoiler tags are for Neverwinter Nights 1:Spoiler goes here(/nwn1)spoiler tags are for Neverwinter Nights 2:Spoiler goes here(/nwn2)spoiler tags are for Neverwinter Online:Spoiler goes here(/nwo)spoiler tags are for any other content:Spoiler goes here(/other)Regarding Moderators:At the moment this sub is look for volunteers to help us moderate.
else return (num_days+dCode)%7;}
// calculate the first day of the year int getDayCode(int year){ int fday; fday=(((year-1)*365+(year-1)/4-(year-1)/100+(year-1)/400)+1)%7; return fday; } void printCar(int year, int month){ int fday_month=getFirstDay(year,month); int code[7]={0,1,2,3,4,5,6}; char *Day[7]={'Sun','Mon','Tues','Wed','Thu','Fri','Sat'}; char *Month[12]={'January','February','March','April','May','June','Junly','August','September','October','November','December'}; int num_days,i; if(month1||month3||month5||month7|| month8|| month10|| month12) num_days=31; else if(month2) {
; if((year%40) || (year%4000)) num_days=29;else num_days=28;
} else num_days=30; cout<<'n.......'<<><> cout<<'First day of the month:'<<><> cout<<'Sunt'<<'Mont'<<'Tuest'<<'Wedt'<<'Thut'<<'Frit'<<'Sat'<<> for(i=1;i<=fday_month;i++) cout<<'t'; int d=1; int con=0; while(d<=num_days) { cout<<d<<'t'; if(fday_month>0) { if(d7-fday_month) {cout<<'n';con=d;} else if(d%(con+7)0) {cout<<'n';con=d;} } else if(d%70) cout<<'n'; d++; <> <>
} cout<<'n'; } Comments
C++ Calendar CodeDev C++ Code Examples
We're not going to do your homework for you, however we will help guide you to the solution.
So what information do you need to be able to print the calendar for the given month? You need to know two things: 1) The day of the week that the 1st of the month falls on; and 2) How many days are in the month. You already have a function that tells you what day January 1st falls on in any given year. And you already have a function that tells you how many days are in a given month in a given year. So how can you use those two functions to figure out what day of the week the 1st falls on for any given month/year? If you know the algorithm but are having trouble writing the code, then please post your algorithm and your non-working code. If you can't figure out the algorithm, then try this exercise and see if the algorithm becomes obvious to you: 1) Figure out what day of the week January 1st, 1901 falls on. 2) Now figure out what day of the week February 1st, 1901 falls on. 3) Now figure out what day of the week March 1st, 1901 falls on. 4) Now figure out what day of the week April 1st, 1901 falls on. Do you see a pattern? Comments are closed.
|
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |