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
dolphi86 [110]
3 years ago
8

Writing a modular program in visual c++. I am new to this and not sure what I am missing. I am getting the following error:

Computers and Technology
1 answer:
stich3 [128]3 years ago
7 0

Answer:

#include <iostream>

bool validateDate(int, int, int);

using namespace std;

int main()

{

int year;

int month;

int day;

const int MIN_YEAR = 0, MIN_MONTH = 1, MAX_MONTH = 12, MIN_DAY = 1, MAX_DAY = 31;

bool validDate = true;

   cout<<"Enter the year"<<endl;

   cin>>year;

   cout<<"Enter the month"<<endl;

   cin>>month;

   cout<<"Enter the day"<<endl;

   cin>>day;

if(year <= MIN_YEAR) // invalid year

    validDate = false;

else if (month < MIN_MONTH || month > MAX_MONTH) // invalid month

    validDate = false;

else if (day < MIN_DAY || day > MAX_DAY) // invalid day

    validDate = false;

if(validDate == true)

{

    // Output statement

    cout<<month<<"/"<<day<<"/"<<year<<"is a valid date"<<endl;

}

else

{

    // Output statement

    cout<<month<<"/"<<day<<"/"<<year<<" is an invalid date"<<endl;

}

}

Explanation:

  • Declare variables and take the date as input from user .
  • Inside the main function, check if year is valid using the conditional statements.
  • Check if date is valid and then output that accordingly.
You might be interested in
In order for you to realize there has been a sensory change, it has to reach the __________ level of processing.
Kryger [21]

Answer: In order for you to realize there has been a sensory change, it has to reach the <u>perceptual</u> level of processing.

6 0
4 years ago
A pedometer treats walking 2,000 steps as walking 1 mile. Write a program whose input is the number of steps, and whose output i
Amanda [17]

Answer:

import java.util.Scanner;

public class num1 {

   public static void main(String[] args) {

   Scanner in = new Scanner(System.in);

   //Prompt and receive user input

       System.out.println("Enter number of Steps");

       int numSteps = in.nextInt();

       double numMiles = numSteps/2000;

       //Print the formated number of miles

       System.out.printf("The equivalent miles is %.2f ",numMiles);

   }

}

Explanation:

  • This is solved using Java programming language
  • Scanner class is imported and used to receive user input (number of steps walked)
  • To convert number of steps to number of miles, we divide by 2000, Since the question says the pedometer treats walking 2,000 steps as walking 1 mile.
  • Output the number of miles to 2 decimal places using java's printf() method
6 0
4 years ago
Read 2 more answers
Research the difference between the heart and the brain ???? and say which is most important and why????​
antoniya [11.8K]

Answer:

The brain is more important because the heart would not be able to function without instructions from the brain, which is very important. The brain is what gives orders to the rest of the body to keep everything going.

Sorry if my explanation sounds bad, I'm not great at wording things))

6 0
3 years ago
Which of these strategies do you practice when tests are returned to you? Check all that apply.
victus00 [196]

Answer:

I apply numbers...

5, 6 and 3

7 0
3 years ago
Read 2 more answers
The inside color of text or of an object is called the:
AnnyKZ [126]
Fill color is the answer hope this helps
8 0
3 years ago
Other questions:
  • What can I do with this? Lol
    15·1 answer
  • simpley convert the code below to assembly languageYour proof-of-study task is to hand-compile the code below into an assembly l
    11·1 answer
  • Which ieee 802.11 standard provides for throughput of up to 7 gbps?
    8·1 answer
  • If a small monster collector:- Has 16 small monster containment devices and intends to use all of them.
    10·1 answer
  • Gimme a Krabby Patty
    8·2 answers
  • Which of the following is a hardware component used to hold the BitLocker encryption key and ensures encrypted data is not acces
    5·1 answer
  • How many bits long is a autonomous system number?
    13·1 answer
  • After pushing the power switch of the PC to the ʺonʺ position, Bob, the PC repair person, realizes that the power-on lights foun
    8·1 answer
  • Define computer memory and write it's type ​
    6·1 answer
  • Why can a CPU retrieve and process bits of data quickly?
    14·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!