1answer.
Ask question
Login Signup
Ask question
All categories
  • English
  • Mathematics
  • Social Studies
  • Business
  • History
  • Health
  • Geography
  • Biology
  • Physics
  • Chemistry
  • Computers and Technology
  • Arts
  • World Languages
  • Spanish
  • French
  • German
  • Advanced Placement (AP)
  • SAT
  • Medicine
  • Law
  • Engineering
dlinn [17]
3 years ago
9

Write a program that prints the U.S. presidential election years from 1792 to present day, knowing that such elections occur eve

ry 4 years.
Computers and Technology
1 answer:
miv72 [106K]3 years ago
4 0

Answer:

The cpp program to print US presidential years is given.

#include <iostream>

using namespace std;

int main()

{

   // variable to hold presidential election year declared  

   int elec_year;

// variable to hold presidential election year initialized to 1792  

elec_year=1792;

   

// the value displayed on the console output

   std::cout << "The U.S. presidential election years from 1792 to present day are listed. " << std::endl;

   

   // loop executes till year is less than or equals 2020

   do

   {

       // initial value is printed

       std::cout << elec_year << std::endl;

       

       // value is incremented by 4

       elec_year = elec_year + 4;

       

   }while(elec_year<=2020);

   return 0;

}

OUTPUT

The U.S. presidential election years from 1792 to present day are listed.  

1792

1796

1800

1804

1808

1812

1816

1820

1824

1828

1832

1836

1840

1844

1848

1852

1856

1860

1864

1868

1872

1876

1880

1884

1888

1892

1896

1900

1904

1908

1912

1916

1920

1924

1928

1932

1936

1940

1944

1948

1952

1956

1960

1964

1968

1972

1976

1980

1984

1988

1992

1996

2000

2004

2008

2012

2016

2020

Explanation:

The program works as described.

1. An integer variable, elec_year, is declared and initialized with the first US presidential year value, 1792.

2. Inside the do-while loop, the variable, elec_year, is first printed to the console followed by a new line inserted using, endl.

3. The variable, elec_year, is then incremented by 4.

4. The do-while loop continues till the value of the variable, elec_year, does not exceeds the current year, 2020.

5. The program ends with a return statement since main() has return type int.

6. Only one variable is used in the program.

7. The program consists of only main() method since cpp is not completely object oriented programming language.

8. The same program, if written in object oriented programming language like java or c# will be written inside a class and executed through main() method.

You might be interested in
Which orientation style has more height than width?
gayaneshka [121]

Answer:

"Portrait orientation" would be the correct answer.

Explanation:

  • The vertical picture, communication as well as gadget architecture would be considered as Portrait orientation. A webpage featuring portrait orientation seems to be usually larger than large containing lettering, memo abases as well as numerous types of content publications.
  • One such volume fraction also becomes perfect for impressionism depicting an individual from either the top.

Thus the above is the correct answer.

3 0
3 years ago
After clicking the Start button on your computer screen desktop, what option would you then select to examine system components
Sveta_85 [38]
You can find the components that you wanted to modify in : C. control panel

You can adjust your computer's setting through control panel, whether it's your system and security, hardware, net work setting, etc

hope this helps
4 0
4 years ago
Read 2 more answers
ANSWER QUICKLY!
patriot [66]

Answer:

It is bit { measurement used to quantify computer data. }

7 0
3 years ago
When there is uncertainty of the product quality, buyers should not anticipate that the temporary warehouse seller of unbranded
Westkost [7]

Answer:

Offer several prices and qualities.

Explanation:

When there is uncertainty of the product quality, buyers should not anticipate that the temporary warehouse seller of unbranded computer equipment will deliver high quality because they will actually offer several prices and qualities.

In the essence, buyers will need to consider the value they are getting for a price they pay. There will be huge variety so the more price an equipment has, the more likely it has the chance that it's one of the best quality and vice versa also holds true.

6 0
3 years ago
List the five body functions that monitor homeostasis.
IceJOKER [234]
You can also have homeostatis by shivering and sweating

6 0
3 years ago
Other questions:
  • A customer service representative for an Internet provider uses various techniques to help a frustrated customer with a slow Int
    13·1 answer
  • In a C++ program, two slash marks ( // ) indicate:
    7·1 answer
  • When the tcp\ip translates a network layer address into a data link layer address (after not finding an entry for the network la
    13·1 answer
  • What is the Difference between CUI and GUI
    14·2 answers
  • Consider a system that uses a 32-bit unique salt where users have a 4-digit number as a password (e.g. 6813). Eve wants to crack
    8·2 answers
  • Whats important about the points?
    10·2 answers
  • Whay is processing?Explain with an example.​
    9·2 answers
  • What are the paparazzi?
    8·1 answer
  • How do you change your name on your brainly profile
    14·2 answers
  • Evaluate and compare free and commercial versions of the Avast antivirus software
    6·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!