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
What expressions will initialize d with a random value such that all possible values for d are given by the inequality 1.5 ≤ d &
Kaylis [27]

Answer:

The solution code is written in Python

d = 1.5 + random.random() * 6

Explanation:

By presuming the Python random module is imported, we can use the <em>random</em> method to generate a random number.  <em>random.random()</em> will give us a value in the range [0, 1). The ensure the lower limit is 1.5 instead of 0, we can add 1.5 to random.random()

  •      1.5 + random.random()

This expression will give any value in range [1.5, 2.5)

To ensure the upper limit is set to 7.5, we tweak the previous expression to

  • 1.5 + random.random() * 6  

This expression will always multiply a random number from [0,1) with 6 and then only added with 1.5. This will always produce a random number that fulfill the inequality 1.5 ≤ d < 7.5

7 0
3 years ago
What font family is Times New Roman an what font family is Arial?
Alexxandr [17]

Answer:

Some Font Examples

Generic Font Family                 Examples of Font Names

Serif                    Times New Roman Georgia Garamond

Sans-serif                          Arial Verdana Helvetica

Monospace                     Courier New Lucida Console Monaco

Cursive                        Brush Script MT Lucida Handwriting

Explanation:

hope it help

4 0
3 years ago
Read 2 more answers
Match the feature to its function.
Roman55 [17]

The Matchup of the feature to its function are:

1. Normal view the place where creating and editing occurs .

2. Notes view an area in which information for handouts can be added.  

3. Slide pane the place where the slide order can be changed.

4. Menu bar contains lists of commands used to create presentations  

5. toolbars provide rows of icons to perform different tasks.

<h3>What is the normal view?</h3>

Normal view is known to be the view that is seen or used in editing mode and this is where a person can work a lot of items so that they can create their slides.

Note that Normal view is one that shows slide thumbnails on the left, that is a large window that depicts the current slide, and also has a  section that is often seen below the current slide.

The Matchup of the feature to its function are:

1. Normal view the place where creating and editing occurs .

2. Notes view an area in which information for handouts can be added.  

3. Slide pane the place where the slide order can be changed.

4. Menu bar contains lists of commands used to create presentations  

5. toolbars provide rows of icons to perform different tasks.

Learn more about Normal View from

brainly.com/question/14596820

#SPJ1

6 0
2 years ago
UDP provides unreliable data transfer and therefore
vova2212 [387]

Answer: The answer is d.

Explanation:

UDP is a transport protocol (Layer 4 of the OSI model) that has no mechanism to provide a reliable transport between the source process and the destination one, as TCP does.

Anyway, due to this feature, is specially suitable for real-time applications , like video or audio, provided that the user can accept some loss in the stream.

Several real-time protocols, like RTP for instance (used for videoconferencing)  use UDP as transport protocol.

4 0
3 years ago
To move the first line of text over five spaces and leave the other lines of the paragraph aligned to the left, use the _____ fe
Lera25 [3.4K]

To move the first line of text over five spaces and leave the other lines of the paragraph aligned to the left, use the FIRST LINE INDENT.

<h2>Your answer would be B. First Line Indent</h2><h3><u><em>hope this helps</em></u></h3>
4 0
3 years ago
Read 2 more answers
Other questions:
  • ATM machines respond to request in__________​
    13·1 answer
  • If userA wants to send a secure message to userB using an asymmetric cryptographic algorithm, which key does userB use to decryp
    11·1 answer
  • You administer a Microsoft SQL Server database that supports a banking transaction management application. You need to retrieve
    5·1 answer
  • Which command should you enter to configure a single port to discard inferior bpdus 200-125?
    5·1 answer
  • A ________ is a term used to describe a select list that allows the user to select an option to load another web page.
    10·1 answer
  • Discuss, in brief thedifferent variations of BLAST. (Maximum 5 innumber)
    10·1 answer
  • Give two examples of html structure
    15·1 answer
  • What are some of the issues that create conflict in the future and why?
    12·1 answer
  • ¿Cuales son los dos estados de una computadora y que significa cada uno?
    8·1 answer
  • _____ are labels for data, while _____ tie values together into one entity.
    15·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!