Print US Presidential Election Years Since 1792

  • C/C++
  • Thread starter ineedhelpnow
  • Start date
  • Tags
    Years
In summary, Modify the program to print the U.S. presidential election years since 1792 to present day, knowing such elections occur every 4 years. Don't forget to use <= rather than == to help avoid an infinite loop. She is clearly giving it a try, don't be so hard on her, I'm sure you also encountered issues when learning C++ and had people there to help out.
  • #1
ineedhelpnow
651
0
Modify the program to print the U.S. presidential election years since 1792 to present day, knowing such elections occur every 4 years. Don't forget to use <= rather than == to help avoid an infinite loop.

Code:
#include <iostream>
using namespace std;

int main() {
   int electYear = 0; 
   
   electYear = 1792;
   // FIXME: Put the following in a while loop 
   cout << electYear << endl;

   return 0; 
}

how do i do this?
 
Technology news on Phys.org
  • #2
ineedhelpnow said:
Modify the program to print the U.S. presidential election years since 1792 to present day, knowing such elections occur every 4 years. Don't forget to use <= rather than == to help avoid an infinite loop.

Code:
#include <iostream>
using namespace std;

int main() {
   int electYear = 0; 
   
   electYear = 1792;
   // FIXME: Put the following in a while loop 
   cout << electYear << endl;

   return 0; 
}

how do i do this?

Do.. do you have any thoughts on the matter at all? I'm asking because most if not all of your C++ questions lately have been of the form "here is some code, how do I implement this". You need to at least give it a try.
 
  • #3
i know. i have been trying to understand. but these last lessons we've been going over make no sense to me. I am trying to understand but its all fuzzy. most of the ones I've been posting lately also arent homework problems. they are just activities.
 
  • #4
Bacterius said:
Do.. do you have any thoughts on the matter at all? I'm asking because most if not all of your C++ questions lately have been of the form "here is some code, how do I implement this". You need to at least give it a try.

She is clearly giving it a try, don't be so hard on her, I'm sure you also encountered issues when learning C++ and had people there to help out.
 
  • #5
ineedhelpnow, imagine that it's now 1815 instead of 2015. Could you do manually what you need the program to do, i.e., write election years until 1815? While doing it, think carefully about what steps you are performing. Are you adding numbers? Are you comparing them? How do you know it's time to stop? Can you do this if you have only limited space to write numbers on paper, but you can erase old numbers and write new ones in the same space?

After you do this, try to describe the sequence of steps you had to perform and post this description.
 

FAQ: Print US Presidential Election Years Since 1792

1. What is the purpose of printing US presidential election years since 1792?

The purpose of printing US presidential election years since 1792 is to provide a historical record of the presidential election dates in the United States. This information can be used for research purposes, to track patterns and trends in election years, and to serve as a reference for future elections.

2. How often are US presidential elections held?

US presidential elections are held every 4 years, on the first Tuesday after the first Monday in November. This has been the standard election date since 1845.

3. Have there been any changes to the election schedule since 1792?

Yes, there have been a few changes to the election schedule since 1792. In 1845, Congress set a uniform election day for all states, which is the first Tuesday after the first Monday in November. In 1937, the Twentieth Amendment to the US Constitution moved the presidential inauguration from March 4th to January 20th.

4. How many presidential elections have been held since 1792?

As of 2021, there have been 59 US presidential elections since 1792. This includes the election of George Washington, who was elected unanimously and ran unopposed in 1792 and 1796.

5. Are there any notable historical events associated with US presidential election years?

Yes, there have been several notable historical events associated with US presidential election years. Some examples include the Civil War in 1860, the Great Depression in 1932, and the September 11th terrorist attacks in 2001. Additionally, many significant political and social changes have occurred during election years, such as the passage of the 19th Amendment granting women the right to vote in 1920 and the first African American president being elected in 2008.

Similar threads

Replies
5
Views
2K
Replies
22
Views
2K
Replies
13
Views
1K
Replies
3
Views
3K
Replies
4
Views
2K
Replies
1
Views
1K
Back
Top