Thread: calendar

  1. #1
    Registered User
    Join Date
    Apr 2002
    Posts
    1

    Question calendar

    I need assistance with source code for a calendar Please review my input and list what is needed
    #inclue<iostream.>

    void start();
    void firstr();
    void rest();
    void otpt();

    int year;startc, count=1,cal [6][7];

    void main()

    {

    cout<<"this is my calendar program."<<endl;
    <<"enter any year equal to or greater then 1961:";
    cin>>year;

    start();
    firstr();
    rest();
    otpt:

    }

    void start()

    {

    int diff,ly,tdiff,startc;

    diff=year-1961; //(2002-1961)=41 the difference in the years that are the input
    ly=int(diff/4); //ly=int(41/4)=(10.25)=10
    tdiff=dif+ly; //tdiff=41 + 10=51
    startc=tdiff%7; //startc=51 % 7=8 (%=mod=51/7=a remainder of 8.)
    }

    void firstr()

    {

    int y;

    for (y=startc;y<7y++)
    {
    cal[0][y]=count
    count++;

    }

    }

    void rest()

    {
    int x,y;
    for (x=1;x<6;x++)
    for (y=0;y<7;y++)
    {
    cal[x][y]=count;
    count++;
    }

    }

    void otpt()

    {

    intx,y;
    cout<<" jan "<<year<<endl;
    cout<<"s"<<\tm"<<"tt:<<\tw"<<\tth"<<"\tf"<<"\ts";

    for(x=0;x<6;x++);
    {
    for(y=0;y<7;Y++);
    {
    if ((cal[x][y],1)||(cal[x][y]>31))
    cout<<" "<<\t";
    else
    cout<<cal[x][y]<<"\t";

    }
    }

    for(x=0;x<6;x++)
    {
    for(y=0;y<7;y++)
    cout<<cal[x][y]<<"\t";

    return 0;
    }
    cout<<endl;

    }

  2. #2
    Registered User xlnk's Avatar
    Join Date
    Mar 2002
    Posts
    186
    to start off with. lots of typos.

    Code:
    #include <iostream.h> 
    #include <conio.h> 
    
    void start(); 
    void firstr(); 
    void rest(); 
    void otpt(); 
    
    int year, startc, count=1,cal [6][7]; 
    
    void main() 
    
    { 
         clrscr();
         cout<<"this is my calendar program."<<endl;  
         cout << "enter any year equal to or greater then 1961:"; 
         cin>>year; 
    
         start(); 
         firstr(); 
         rest(); 
         otpt();
         getch();
    }
    Last edited by xlnk; 04-03-2002 at 06:23 PM.
    the best things in life are simple.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Writing a program to make a calendar
    By Northstar in forum C Programming
    Replies: 17
    Last Post: 11-07-2007, 11:34 AM
  2. how to convert from solar calendar to lunar calendar??
    By zaracattle in forum C++ Programming
    Replies: 7
    Last Post: 11-30-2006, 07:17 AM
  3. calendar program for linux
    By *ClownPimp* in forum Tech Board
    Replies: 1
    Last Post: 10-01-2005, 02:31 AM
  4. Calendar Program. What am I doing wrong?
    By Sektor in forum C++ Programming
    Replies: 3
    Last Post: 01-17-2004, 11:39 PM
  5. writing a calendar program help please!!!
    By Newbie2006 in forum C Programming
    Replies: 7
    Last Post: 11-20-2002, 07:36 PM