Calendar Board

T

tomakated

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|
 
T

tomakated

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<!!!.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
474,184
Messages
2,570,978
Members
47,561
Latest member
gjsign

Latest Threads

Top