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
Write a program that print "Censored" if userInput contains the word "darn", else print userInput. End with newline.
Ainat [17]

Answer:

userInput = input("Please enter a string of words ")

userInput.split ()

for item in userInput.split ():

   if item =="darn":

       print("Censored")

       break

else:

   print(userInput)

Explanation:

Using Python programming language, the input function is used to receive the users input and save in a variable userInput

Then the .split method is used to convert the words into a list of words.

Using a for loop, the code checks for the word darn and prints censored if it exists else it prints the userInput

7 0
2 years ago
Every page on a website must be updated recently to consider the website updated/maintained
guajiro [1.7K]
Unmaintained. hope that helped
6 0
2 years ago
Read 2 more answers
You should always buy the biggest camera bag that you can find for extra equipment.
Akimi4 [234]

Answer:

true

Explanation:

7 0
2 years ago
Read 2 more answers
In which method of encryption is a single encryption key sent to the receiver so both sender and receiver share the same key?
mars1129 [50]

Answer:

B. Symmetric key encryption

Explanation:

Symmetric key encryption is one in which a single encryption key is sent to the receiver so both sender and receiver share the same key. In this type of encryption, the sender uses a particular key to encrypt the data and sends the encrypted data (cipher data) to the receiver and then the receiver uses the same key to decrypt the data.

Public key encryption, or asymmetric encryption uses two keys - a private key and a public key. The public key is know to everyone while the private key is known only to those for whom the message is intended. An application of this type of encryption is in SSL (Secure Sockets Layer) -  a protocol for transmitting data privately on the internet.

Private key encryption is not exactly one of the encryption methods but rather, a private key and a public key are used in encryption.

The best option is therefore <em>symmetric key encryption</em>.

<em>Hope this helps!</em>

7 0
2 years ago
Write a few statements that open a file called "greeting", write the message "hey!" to the file -- and then close it. declare an
pshichka [43]
C++:

int main () {

std::ofstream output {"greeting.txt"};
output << "hey!";
output.close();

return 0;
}
6 0
3 years ago
Read 2 more answers
Other questions:
  • business owners and managers may first balk at the idea of mobile officer workers because there may appear to be a lack of ___ w
    9·1 answer
  • 18. Applying what formatting option to your Excel workbook will make it easier to read when printed out?
    9·1 answer
  • When parking uphill on a street with no curb, how should your front wheels be positioned? A. Turned to the left (toward the stre
    14·2 answers
  • The clear emergence of a leader and the development of group norms and cohesiveness are the key indicators of the ________ stage
    6·1 answer
  • A _____ is a type of legal protection for which person can apply to protect an invention or a discovery.
    9·1 answer
  • 1a. Ust Seven (7) Components of a Computer?
    13·1 answer
  • Can someone help me with this code please explain it to me in simple way
    15·1 answer
  • Drag each tile to the correct box.
    9·2 answers
  • Discuss the advantages of using analogue multi-tester or digital multi-tester over the other.​
    12·1 answer
  • PLEASE HELP! (NO LINKS)
    7·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!