program c++

In the sugar town of friendly north, a cane harvesting festival is held every 6th year.These celebrations began in the year 1980. Given a future period- defined by a start year and an end year- write a program to determine the years in which the festival is celebrated.
The program should accept as input a start year and end year to indicate the period being considered. your program should check;
- start year is 1980 or greater
- end year is greater than start year

my piece of code is given below. can any one tell how to add six to the start year till the end year approaches.


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
32
#include <iostream>

using namespace std;

double start_year;
double end_year;
char response='y';

int main()

{
	while  (response=='y' || response=='Y' ) // if resonpse is yes then excute the program again 
{

cout<<"Welcome to Friendly North Festival Calender\n"<<endl;

cout<<"Please enter the start year => ";
cin>>start_year;

cout<<"Please enter the end year => ";
cin>>end_year;

cout<<"During the period " << start_year<< " - " <<end_year<<endl;
cout<< "The Friendly North Festival will be celebrated in:"<<endl;


cout << "\tDo You Want To Run This Program Again [Y/N] ";
	cin >> response;
}
system ("PAUSE"); 
		return 0;
}
Last edited on
closed account (G1vDizwU)
Use code tag please.
HOW TO USE CODE TAG PLEASE
closed account (Nv48AqkS)
Just finished a C ++ program similar to this
Last edited on
In the sugar town of friendly north, a cane harvesting festival is held every 6th year.These celebrations began in the year 1980. Given a future period- defined by a start year and an end year- write a program to determine the years in which the festival is celebrated.
The program should accept as input a start year and end year to indicate the period being considered. your program should check;
- start year is 1980 or greater
- end year is greater than start year

my piece of code is given below. can any one tell how to add six to the start year till the end year approaches.

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
32
#include <iostream>

using namespace std;

double start_year;
double end_year;
char response='y';

int main()

{
	while  (response=='y' || response=='Y' ) // if resonpse is yes then excute the program again 
{

cout<<"Welcome to Friendly North Festival Calender\n"<<endl;

cout<<"Please enter the start year => ";
cin>>start_year;

cout<<"Please enter the end year => ";
cin>>end_year;

cout<<"During the period " << start_year<< " - " <<end_year<<endl;
cout<< "The Friendly North Festival will be celebrated in:"<<endl;


cout << "\tDo You Want To Run This Program Again [Y/N] ";
	cin >> response;
}
system ("PAUSE"); 
		return 0;
}
closed account (Nv48AqkS)
if you want help you let me know buddy, im offering it.
add this yo your code

1
2
3
cout<< "The Friendly North Festival will be celebrated in:"<<endl;
for(int i=start_year;i<=end_year;i+=6)//i+=6 is same as i=i+6
cout<<i<<endl;


Also I would recommend you to read about loops
Last edited on
adam151 wrote:
if you want help you let me know buddy, im offering it.

Um, of course the OP wants help. That's why they're posting the thread. So why don't you give them your help right here in the thread, where it was asked for?

Or are you spamming for private tutorial work?
MikeyBoy wrote:
Or are you spamming for private tutorial work?

@MikeyBoy: Seeing as his entire post history is essentially the same type of work, I would have to conclude you are correct.
Last edited on
Topic archived. No new replies allowed.