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
Two DHCP servers, Server1 and Server2, are running Windows Server 2016. As the administrator, you create a scope called Scope1.
kumpel [21]

Answer:

The answer is "Option a"

Explanation:

Split-scope is also an easy and simple approach to deliver DHCP consistency and workload management into your system. Server 2008 R2 provides a convenient divide-scope guide which removes several operational efforts but can only be to use if all databases run on R2, and wrong choices can be described as follows:

  • In option b, It uses the Ip address for multicast, that's why it is wrong.
  • In option c, It is wrong because it uses a windows interface, that works on policies.  
  • In option d, It is wrong because it is an administrative feature.

5 0
3 years ago
What is microsoft access?
atroni [7]
Microsoft Access is a database management system that is part of the Microsoft Office Suite.
8 0
3 years ago
How does accenture generate value for clients through agile and devops?
Tomtit [17]

Through quicker time to market, better quality products, and higher customer satisfaction Agile and DevOps are key components of Accenture's value creation for clients.

Accenture plc is a Dublin-based, Irish-American professional services firm with a focus on information technology (IT) services and consulting. It was listed on the Fortune Global 500 and recorded $61.6 billion in revenue in 2022. 91 of the Fortune Global 100 and more than 75 percent of the Fortune Global 500 are among Accenture's current clients.

When General Electric wanted to install a computer at Appliance Park in Louisville, Kentucky, in the early 1950s, Accenture conducted a feasibility study for the company. This study led to GE installing a UNIVAC I computer and printer, which is thought to be the first commercial use of a computer in the United States.  A post was held by Joseph Glickauf, a pioneer in computer consulting.

To know more about Accenture click here:

brainly.com/question/24302004

#SPJ4

4 0
1 year ago
Imagine a mythical set of protocols with the following details. Maximum Link-Layer data frame: 1,455 bytes Network-Layer header
NemiM [27]

Answer:

The MSS is 1455

Explanation:

MSS or maximum segment size is the total number of data transferred minus the TCP and IP header. The total number of transmitted frames in a switch network is between 64 bytes to 1518 bytes with a header and trailer. The MSS does not exclude this data-link layer effect but only the transport layer like TCP and UDP, and IP address header, unlike the mtu (maximum transfer unit) which involves all headers.

4 0
2 years ago
The IT Department already has been testing Windows Server 2012 R2, and some time ago purchased licenses to convert all of its Wi
Nana76 [90]

Answer:

19

Explanation:

5 0
3 years ago
Other questions:
  • Write a program that reads a list of integers, and outputs those integers in reverse. The input begins with an integer indicatin
    10·1 answer
  • The internet maybe best compared to what
    11·1 answer
  • Which of these components is a part of the Central Processing Unit (CPU) of a computer?
    11·2 answers
  • The master production schedule for Product A shows a need for 30 units, and Product B shows a need of 25 units. To manufacture a
    12·1 answer
  • Which of the following is an example of a trade journal?
    7·2 answers
  • Binary Search:<br><br><br> 2 6 15 42 55 89 111 256
    6·1 answer
  • (Reverse number) Write a program that prompts the user to enter a four-digit inte- ger and displays the number in reverse order.
    9·1 answer
  • Write a paragraph about ICT in personal life?
    12·1 answer
  • Learning Task 2: Identify what is being asked. Write your answers on your notebook 1. What Microsoft Office program is used for
    15·1 answer
  • Type the correct answer in the box. Use numerals instead of words. If necessary, use / for the fraction bar.
    14·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!