I need Help

I'm Beginners level...i need help..

REQUIREMENT / ASSIGNMENT QUESTION
Write a C program that prints a one-month calendar. The user specifies the number of days in the month and the days of the week on which the month begins:

Output
Example

Enter number of days in month : 31
Enter Starting day of the week
(1=Sun, 2=Mon, 3=Tue, 4=Wed, 5=Thu, 6=Fri, 7=Sat) : 3

Sun Mon Tue Wed Thu Fri Sat
1 2 3 4 5
6 7 8 9 10 11 12
13 14 15 16 17 18 19
20 21 22 23 24 25 26
27 28 29 30 31


Tips: This program is not as hard as it looks. The most important part is a for statement that uses a variable i to count from 1 to n, where n is the number of days in the month, then printing each value of i. Inside the loop, an if statement tests whether i is the last day in a week; if so, it prints a new-line character.
What is your question?
My Question, How to create coding c++ --->>> Diplay C Program that print a one Month calendar. user must specifies the number of days in the month and the day of the week on which the month begins.

Enter number of days in month : 31
Enter Starting day of the week
(1=Sun, 2=Mon, 3=Tue, 4=Wed, 5=Thu, 6=Fri, 7=Sat) : 3

Tue 1,8,15,22,29
wed 2,9,16,23,30
thu 3,10,17,24,31
fri 4,11,18,25
Sat 5,12,19.26
Sun 6,13,20,27
Mon 7,14,21,28

can you give me a simple coding, how can i print my output for my question.
sorry i can't speek english, but i try...
What have you gotten done so far on your own? :)
huhuuhu

:(
I try, but still error...pls help...tq


#include <stdio.h>
#include <iostream>
using namespace std;

int calendar[6][7] ;
void cal(int y , int z)
{
int n = 1 ;
for(int j=z-1;j<7;j++)
{
calendar[0][j] = n ;
n++ ;
}
for(int i=1;i<6&&n<=y;i++)
{
for(int k=0;k<7&&n<=y;k++)
{
calendar[i][k] = n ;
n++ ;
}
}
}

int main()
{
int i, j;
int day ;

printf("Enter number of days in month : ") ;
scanf("%d",&i);

printf("Enter Starting day of the week : ") ;
scanf("%d \n",&day) ;
if (i<6)
day = i;
else
j=i;

printf("MON TUE WED THU FRI SAT SUN");
printf("\n") ;

for(int i = 1; i <=7; i++)
{
//for(int j = 0; j <=7; j++)
{
printf("%d",&i);
// i++;
}
printf("\n");
}

}
helpppppp
It's not that hard that you think it is. You don't need an array.

Instead of

printf("Enter Starting day of the week : ") ;

it should read

1
2
printf("Enter the day of the week on which the month begins: ") ;
scanf("%d \n",&starting_day) ;


The loop would be:

1
2
3
4
5
6
7
8
9
10
11
printf("Enter number of days in month : ") ;
scanf("%d",&number_of_days);

...

for(int i = starting_day; i <=number_of_days; i++)
{
  printf("%d",i); // Note no &
  if((i%7) == 0) // This is the trick to place the correct end of line %=modulo
    printf("\n");
}
what you have to do is to insert the correct number of spaces (especially at the beginning
Last edited on
who can help my assignment..

output

Enter password:
password is "bsitit2"
Menu:
[a]add
[e]edit
[d]delete
[q]quit

if wrong password print "login failed"

help me plsss
who can help my assignment..

Please don't try and hijack someone else's thread with a totally unrelated issue. Start your own thread instead, so that people can answer you without getting mixed up with the answers to the original poster's problem.
not required?


int calendar[6][7] ;
void cal(int y , int z)
{
int n = 1 ;
for(int j=z-1;j<7;j++)
{
calendar[0][j] = n ;
n++ ;
}
for(int i=1;i<6&&n<=y;i++)
{
for(int k=0;k<7&&n<=y;k++)
{
calendar[i][k] = n ;
n++ ;
}
}
}
not required?
No, but you can solve it with an array. It depends on what you learned so far and the guidelines of your teacher
TQ Coder777
Topic archived. No new replies allowed.