This program must keep a line after each seven numbers but it is keeping a line after more than 7?
last_day_of_month = last_day_in_month(begin_month + i - 1, begin_year);
int week_days = 1;
while (week_days %26lt;= last_day_of_month)
{
for (I = 0; I %26lt; 7; I++)
{
fout %26lt;%26lt; week_days %26lt;%26lt; " ";
week_days++;
if (week_days == last_day_of_month + 1)
break;
}
if (week_days != last_day_of_month + 1 %26amp;%26amp; I == 7)
fout %26lt;%26lt; endl;
//this is a part of the program i can send the whole program by e-mail
the problem is in the line place not in the number of numbers
C++ language, file problem?
Try this code:
last_day_of_month = last_day_in_month(begin_month + i - 1, begin_year);
int counter=0;
for (int week_days=1;week_days%26lt;=
last_day_of_month;week_days++) {
if (counter==7) {
fout %26lt;%26lt; endl;
counter=0;
} else {
fout %26lt;%26lt; week_days %26lt;%26lt; " ";
counter++;
}
}
fout %26lt;%26lt; endl;
Nelson Bittencourt
See my web site:
http://www1.webng.com/nbittencourt/index...
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment