473,385 Members | 1,732 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,385 software developers and data experts.

Calendar Board

How can I get the dashes and numbers to line up with the dashes above<?.
Want all the "|" to line up and all the Numbers to line up<?
and also how can I get rid of the last line of "---" and the last line of
"|" in the program<?.

#include <iostream>
#include <iomanip>

void calendar (int,int) ;
void printweek (int,int) ;
void lineofdashes() ;
void linewithnumbers(int, int) ;
void linewithoutnumbers();

const int Boxwidth = 7;
const int Boxheight = 4;

int main()
{
calendar (1,9) ;
}

void calendar (int startday, int daysinmonth)
{
int first;

first = startday;
while (first<=daysinmonth)
{
printweek (first, daysinmonth);
first=first+3;
}
linewithoutnumbers();
}

void printweek (int first, int daysinmonth)
{
int i;

linewithoutnumbers ();
linewithoutnumbers ();
linewithnumbers (first, daysinmonth);
for (i=0; i<Boxheight-3; i++)
lineofdashes ();
}

void lineofdashes()
{
int i;
for (i=0; i<3*Boxwidth + 5; i++)
cout << "-";
cout << endl;
}
void linewithoutnumbers()
{
int i;
for (i=0; i<3; i++)
cout << setw(Boxwidth+1) << "|";
cout << endl;
}

void linewithnumbers (int first, int daysinmonth)
{
int i, boxnumber;

boxnumber = first;
for (i=0; i<3; i++)
{
if ((boxnumber >0) && (boxnumber <= daysinmonth))
cout << setw(Boxwidth-1) << boxnumber << "|";
else cout << setw(Boxwidth+1) << "|";
boxnumber ++;
}
cout << endl;
"calendar.cpp" 71 lines, 1164 characters
$ g++ calendar.cpp -o calendar.out
$ calendar.out
| | |
| | |
1| 2| 3|
--------------------------
| | |
| | |
4| 5| 6|
--------------------------
| | |
| | |
7| 8| 9|
--------------------------
| | |

Jul 22 '05 #1
1 1159
I got it to line up I now just need to get it to get rid of the last "|"
dashes after the 3, 6, and 9. and then the last line of "---" and "|"
after the dashes on the bottom<!!!.

Jul 22 '05 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
by: Steve Edwards | last post by:
A designer friend of mine is looking to create a web site for a group of people who share ownership of a property. The two things they would like to do would be to have a calendar function so the...
7
by: TDIOwa | last post by:
I have a form that has a specific date on it. I want to open another form that has the Active Control Calendar on it. I want to open this form to the specific date on the first form. I have...
4
by: Rob Somers | last post by:
Hey people I came across this calendar problem on another board, and so I tried solving it myself, but to no avail. If you run the program as it is now, you should see th problem of the spaces...
2
by: Jeff | last post by:
Has anyone implemented an alarm like the one used with WindowsMobile Calendar? I'm writing a program (C#) that allows a user to set a date and time for meetings, appointments, etc. and have a...
3
by: John Kotuby | last post by:
Hi all, Just wondering. I am converting an ASP application to ASP.NET 2.0. The ASP version used a JavaScript Calendar that would pop up on the client side and populate various text fields with...
4
by: Hypnotik | last post by:
So I'm writing this program. I have the board constructed, and I'm having a problem making a move. At this point I just want to make a move, I'll work on whether it is a legal move after that. The...
4
by: gubbachchi | last post by:
Hi all, Please anybody help me solve this problem. I am stuck up with this from past 2 weeks. I am developing an application where, when the user selects date from javascript datepicker and enters...
1
by: abhishekbrave | last post by:
The code below is opening a calendar on mouse over in the same window. I need the calendar to be opened in new window. Have to fulfill this requirement urgentely so posting the whole code here. I...
1
by: poopsy | last post by:
hi all, i'm trying out some examples on java..and i found this code where there is board and i cant find out what package to import to make this work, im getting error where there is "board".. i...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.