answer.
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]
2 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]2 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
In which of the security mechanism does the file containing data of the users/user groups have inbuilt security?
max2010maxim [7]

Answer:

The answer is "It uses the section access with in the qlikview script".

Explanation:

QlikView is now QlikSense, it comes with section access, that protects against this danger. It a way of determining, which can display certain details, it is also known as objects, that can be displayed by whom and out of which domain, etc.

  • It can also be configured using the publishing of the company. In the data load script, users can use section access to maintain security.  
  • It uses the data for authentication and authorization within segment access and automatically decreases the information, such that users only have their information.
8 0
2 years ago
What will be the output of the following Python code? class A: def test1(self): print(" test of A called ") class B(A): def test
Vlad [161]

Answer:

"test of B called"

Explanation:

  • The object is created for the D class, but there are two test methods in class B and C.
  • The D class does not hold any test method. So when the object called the test method. Then the B method is called.
  • It is because the B class is declared first in the inheritance of D class like in the statement "class D(B, C)".
  • If the statement will be "class D(C, B)", then the C method will be called.
  • if the D class holds the method test, then only the D method will be called.
  • Hence the output is "test of B called".
7 0
2 years ago
Match each logical function with its description. AND COUNTIF SUMIF IF tests for a certain condition and returns one of two valu
lakkis [162]
1. IF
2. AND
3. COUNTIF
4. SUMIF
4 0
2 years ago
1. PLCs were originally designed as replacements for: a) microcomputers. c) analog controllers. b) relay control panels. d) digi
timama [110]

Answer:

PLCs (Programmable logic controller) were original designed as replacement for relay control panels.  Relay is another word for a switch. Relay control panels were made for the control of electronic instrumentents or devices. Later on PLCs were made to replace these timers and relay control panels. PLCs are more reliable, flexible and can work better in the harsh environmental situations then the relay control panels.

3 0
2 years ago
In Linux, the most popular remote access tool is OpenSSH. Which software performs the same remote command line (CLI) access from
maxonik [38]

Answer:

Putty

Explanation:

PuTTY is an SSH and telnet client for Windows and Unix platform. PuTTY is an open source terminal emulator, serial console and network file transfer application. It does not only support SSH and telnet, it also supports other network protocols like SCP, rlogin, and raw socket connection.

To make use of the SSH client on windows, you need to first download and then install the PuTTY software.

6 0
2 years ago
Other questions:
  • Which of the following is true about simulation games? A. Simulation games involve competing in a sport against other players. B
    10·2 answers
  • Currently, there are two major techniques used to develop programs and their procedures. name and describe them. html editor key
    11·1 answer
  • In a particular jurisdiction, taxi fares consist of a base fare of $4.00, plus $0.25 for every 140 meters traveled. Write a func
    11·1 answer
  • Define a function PyramidVolume with double parameters baseLength, baseWidth, and pyramidHeight, that returns as a double the vo
    7·2 answers
  • A user calls the help desk and reports that the workstation, when powering up, displays error messages about an invalid system d
    8·1 answer
  • Database management systems are expected to handle binary relationships but not unary and ternary relationships.'
    7·1 answer
  • Under what conditions might the Justice Department approve a merger between two companies that operate in an industry with a pos
    14·1 answer
  • Omar wants to add transitions to his presentation, so he clicks the Transitions tab. Which tasks can he now complete? Check all
    10·1 answer
  • You should see an error. Let's examine why this error occured by looking at the values in the "Total Pay" column. Use the type f
    14·1 answer
  • Jason Chang is creating photos of his restaurant for a new website. Some of the photos of the staff have red eye, others are bad
    7·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!