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
Maksim231197 [3]
3 years ago
10

Design a program that asks the user to enter a month (in numeric form), a day, and a two-digit year. The program should then det

ermine whether the month times the day equals the year. If so, it should display a message saying the date is magic. Otherwise, it should display a message saying the date is not magic.
Computers and Technology
1 answer:
Irina-Kira [14]3 years ago
7 0

Answer:

#include <iostream>

using namespace std;

int main()

{

   int mt, day, yr, magic;

   cout << "Enter a month(numeric form)"<< endl;

   cin >> mt;

   cout << "please enter a day"<<endl;

   cin >> day;

   cout << "please enter a year"<< endl;

   cin >> yr;

   // Input Validation

   if (mt<1 || mt>12){

       cout<<"Invalid Month";

   }

   else if (day<1||day>31){

       cout<<"Invalid Day";

   }

   else if (yr>99||yr<0){

       cout<<"Invalid Year";

   }

   else{

   // Calculates magic

   magic = (mt * day);

   if (magic == yr)

   {

   cout << "it is a magic year"<<endl;;

   }

   else

   cout << "It is not a magic year" << endl;

   }

   return 0;

}

Explanation:

Using C++ we request the user to enter values for Month, day and year (two digits). We carry out input validation to ensure the user enters a valid month, day and year. Using if/elseif/if statements we ensure the conditions given in the question.

You might be interested in
The most common cause of foodborne illness is
nignag [31]

Answer:

Food posioning

Explanation:

8 0
4 years ago
Read 2 more answers
In a non-price rationing system, consumers receive goods and services first-come, first served. Give me an example of a time whe
Anna35 [415]

When someone may be giving away something for free.

7 0
3 years ago
Now, it’s time for you to begin coding your text-based adventure game!Starting at the top, convert each line of your pseudocode
alexira [117]

Answer:

what is your question? I can't answer this question haha

4 0
3 years ago
Read 2 more answers
Multiple layers provide multiple road blocks for a ________.
Hatshy [7]

Individual or other words user and attackers

4 0
4 years ago
Need help with this question please help it’s on c++
yan [13]

Answer:

b

Explanation:

if you look at the end of the code it brings c back but for it to do that it has to make a newline.

8 0
3 years ago
Other questions:
  • A navigation device that transfers packets of data between two or more networks is called a _______
    12·1 answer
  • URGENT!! Which graphic design tools help you draw circles and rectangles?
    12·2 answers
  • Which of the follow represents a form of disruptive technology? Tend to open new markets and destroy old ones A new way of doing
    11·1 answer
  • Which toolbar is located next to the office button and contain the commonly used commands​
    15·1 answer
  • 1841 William Henry ____________ patents the Calotype process, exposing wet (instead of dry) paper for a much shorter amount of t
    14·1 answer
  • The help desk received a call from a user who cannot get any print jobs to print on the locally shared printer. While questionin
    10·2 answers
  • Microprocessors can’t directly understand programming languages, so programs have to be converted into _____________ that corres
    15·1 answer
  • Naomi wants to search for online courses on web development she types this term in the address bar which browser allows her to u
    8·1 answer
  • In a _______ format, the date line and the signature block are centered.
    6·1 answer
  • How have productivity programs improved the professional lives of people? (check all that apply)
    12·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!