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
expeople1 [14]
2 years ago
11

Write two cin statements to get input values into birthMonth and birthYear. Then write a statement to output the month, a dash,

and the year. End with newline. The program will be tested with inputs 1 2000, and then with inputs 5 1950. Ex: If the input is 1 2000, the output is: 1-2000 Note: The input values come from user input, so be sure to use cin statements, as in cin >> birthMonth, to get those input values (and don't assign values directly as in birthMonth
Computers and Technology
1 answer:
snow_lady [41]2 years ago
6 0

Answer:

// here is code in c++.

#include <bits/stdc++.h>

using namespace std;

// main function

int main() {

// variables to read birth month and year

int birthMonth,birthYear;

cout<<"Enter the birth month:";

// read the birth month

cin>>birthMonth;

cout<<"Enter the birth Year:";

// read the birth year

cin>>birthYear;

// print the output

cout<<birthMonth<<"-"<<birthYear<<endl;

return 0;

}

Explanation:

Declare two variables "birthMonth" and "birthYear". Read the value of birthMonth and birthYear from user. Then print the birth month and birth year and a dash(-) in between them.

Output:

Enter the birth month:1                                                                                                                                      

Enter the birth Year:2000                                                                                                                                    

1-2000  

Enter the birth month:5                                                                                                                                      

Enter the birth Year:1950                                                                                                                                    

5-1950

You might be interested in
How does classless inter-domain routing (cidr) help reduce waste of ip addresses?
Scorpion4ik [409]
It allows for more accurate sizing of networks.
4 0
3 years ago
A low concentration of market power has positive affects. A low concentration of market share has which of the following effects
lisov135 [29]
A or b i think hope it helps good luck and i hope it helps
6 0
3 years ago
Assume the variable myWord references a string. Write a statement that uses a slicing
givi [52]

Answer:

"myWord[-5:]"

Explanation:

So whenever you slice a string, the syntax in python is expressed as:

string[a:b:c]

where a=start index (this is included in the sliced string)

b = end index (this is excluded from the sliced string)

c = increment

If any of these are included, they are set to default values, where a=0, b=len(string), and c=1.

The increment isn't necessary here, and it's just so you know the syntax a bit more

Anyways, I'm assuming when the question asks to display "the last 5 characters in the string" it means in order? e.g "abcdefghijk" -> "ghijk" and not "abcdefghijk" -> "kjihg"

The last piece of information to know is what a negative index represents.

For example if I have the piece of code

"

string = "hello world"

print(string[-1])

"

This will output "d", and the negative 1 represents the last letter. If you did -2, it would output the 2nd to last letter and so on.

So to print the last 5 characters, we simply use the -5 as the starting index.  

"

string = "hello world"

print(string[-5:])

"

This will print "world" or in other words, the last 5 letters. The reason for this is because the -5 in the first spot means the starting index is the 5th to last letter, and when you have the : after the -5, this is the way of telling python you're slicing the string, and not indexing 1 character. You don't need to include another value after that, because it will default to the last index of the string, or more specifically the last index + 1, since the last index is still included.

So the last thing to know, is that if the string isn't greater than 5 characters, it just prints the entire string, and no errors are raised. You can test this out your self as well. So whenever you have a string that's less than 5 characters the entire string is outputted.

3 0
1 year ago
100 points, PLEASE HELP...To generate numbers between and including -10 to 10 you would use:
Orlov [11]

Answer:

A number line?

6 0
2 years ago
What do we call the distribution and access of illegal copies of digital books??
Maru [420]
That concept is piracy


3 0
3 years ago
Read 2 more answers
Other questions:
  • [Submit on zyLabs] Please write a function with one input, a matrix, and one output, a matrix of the same size. The output matri
    10·1 answer
  • What is meaning of reboot
    7·2 answers
  • Of the sequences listed below, which shows the correct order of the steps in the incident management workflow: (1) authenticate
    14·1 answer
  • A 1000 elements array is used to store integers ascending order . The array is used to search binary search algorithm for the in
    14·1 answer
  • Validating the results of a program is important to a. correct runtime errors b. make sure the program solves the original probl
    8·1 answer
  • Where ....................... the books that you borrowed? *
    5·1 answer
  • At year end, Clean123 Inc. has 45500 in cash, 55000 in accounts receivable, 54400 in service equipment, 550 in prepaid insurance
    12·1 answer
  • In Subtractive empathy, the counselor responses gives back less (or distorts) than what the client has said. slightly add someth
    14·1 answer
  • As you are discussing marketing with a client, you try to explain how individuals find sites. Which tool will you explain as the
    8·1 answer
  • You have implemented an access control method that only allows users who are managers to access specific data. Which type of acc
    11·2 answers
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!