BTC USD 81,302.9 Gold USD 4,378.12
Time now: Jun 1, 12:00 AM

Simple C++ calendar..please help me

#include<iostream>
#include<iomanip>
using namespace std;

int main()
{
int numofdays, startofweek, counter;
cout<<"Enter number of days : ";
cin>>numofdays;
cout<<"\nEnter the starting day of the week : ";
cin>>startofweek;

if(numofdays>=28)
{
if(numofdays<=31)
{
cout<<"\n S M T W T F S \n";

for(int counter1=1;counter1<startofweek;counter1++)
{cout<<" ";**

for(counter=0;counter<numofdays+6;counter++)
{

int realnumofdays=counter-startofweek;

cout<<setw(4);

if(realnumofdays>0&&realnumofdays<32)
{
cout<<realnumofdays;
if(((counter)%7)==1)
{cout<<endl;**
**


**
**
**
else
cout<<"\n Wrong input ";

cout<<endl<<endl;

return 0;

**



kat mane silap???? bile aku cin numb of days....execute ..ape salah ye??
 
bru sampai sni...spe nk smbng dari sini

Code:
#include<iostream>

using namespace std;

int main()
{
int mnth,week;

cout <<"\n\nEnter number of days in month: ";
cin>>mnth;
cout<<"\n\nEnter starting day of the week(1=Sun, 7=Sat):";
cin>>week;

if(((mnth<28)&&(mnth>31)) && ((week<1)&&(week>7)))
{cout<<"Invalid Input!";
**
else{
	cout<<"\nS\tM\tT\tW\tT\tF\tS\n";
		for(int j=0;j<7;j++){
			if(week != (j+1)){cout<<"\t";**
			else{
				for(int i=1;i<(8-j);i++){	
					cout<<i<<"\t";
				**
			**
	**cout<<endl;
****

mner dtg bintang nie...?
 
Back
Top
Log in Register