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 function takes two string parameters; the first is the name of a file and the second is text. Complete the function to appen
castortr0y [4]

Answer:

The code for the function is given below in Python language

Explanation:

def append_string_to_file(filename, text):// function takes the filename // and text  to append

f = open(filename, 'a')

f.write(text) //function part that writes the text

f.close() //closing the file using the explicit close function

3 0
4 years ago
Match the crew members with the equipment or tasks they handle.
vovikov84 [41]

Answer:

Boom operator- Microphone

Director of photography- video camera

Art Director- lighting

Gaffer- set building

8 0
3 years ago
Non related to school but im interested,<br><br> Who here actually watches dream smp be honest
Kamila [148]
I did- but I don’t anymore
3 0
3 years ago
Read 2 more answers
Which of the following can a cell contain?
Ksju [112]
The answer is choice D-All of these :)
8 0
3 years ago
Read 2 more answers
Before you insert a page break, what should you do? select the font you want to use for the text that comes after the page break
Triss [41]
Put the insertion point where you want the page to break is what I would write.
7 0
3 years ago
Other questions:
  • An example of hardware is a _____. database spreadsheet monitor program used to enhance photos
    13·2 answers
  • Image files are grouped into two categories: _____.
    5·1 answer
  • A computer is made of up 6 main components: a) CPU (central processing unit)
    7·1 answer
  • A flat-panel detector is exposed with nothing between the x-ray tube and detector. 5 images were acquired on 5 different days us
    6·1 answer
  • A user's computer will not boot. A technician notices four indicator lights on the backside of the
    8·1 answer
  • A lamp outside a front door comes on automatically when it is dark, and when someone stands on the doormat outside the front doo
    7·1 answer
  • Hulu suggestions? I just got it and I wanna know what's good :)
    5·2 answers
  • Design and implement an algorithm that gets a list of k integar values N1, N2,...Nk as well as a special value SUM. Your algorit
    10·1 answer
  • You began a small mobile app company. To help market your apps, you create a social media site. The site allows users to join co
    15·1 answer
  • What problems do you see in the process of transacting business online
    10·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!