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
aleksley [76]
3 years ago
11

NO LINKS

Computers and Technology
1 answer:
horsena [70]3 years ago
3 0

Answer:

#include <iostream>

#include <string>

#include <regex>

using namespace std;

int main()

{

   cout << "Enter a 5-digit number: ";

   string number;

   cin >> number;

   bool valid = regex_search(number, regex("^\\d{4}[02468]$"));

   if (valid) {

       valid = stoi(number.substr(0, 1)) + stoi(number.substr(1, 1))  

           < stoi(number.substr(3, 1)) + stoi(number.substr(4, 1));

   }

   cout << number << (valid ? " is valid" : " is invalid");

}

Explanation:

Regular expressions can do all of your checking except for the sum of digits check. The checks are i.m.o. easiest if you don't treat the input as a number, but as a string with digits in it.

The regex means:

^ start of string

\d{4} exactly 4 digits

[02468] one of 0, 2, 4, 6 or 8 (this is what makes it even)

$ end of string

You might be interested in
What is UTF-8 and why was it created?
Yuki888 [10]

Answer: UTF-8 (Unicode transformation format)  is a technique that is capable of producing any character in Unicode standard.

Explanation: UTF-8 is supporting technique that helps in changing any block of bits of any language.It is used for converting any code into the unicode characters.It was created because this coding technique that supports various languages and is also replacing the ASCII code. UTF-8 code is highly compatible with the ASCII codes and has better properties than it.

5 0
3 years ago
The point where a row and column intersect is called a/an A. cell. B. axis. C. element. D. table.
tino4ka555 [31]
The point where a row and column intersect is called a cell.

I hope this helped!
3 0
3 years ago
Read 2 more answers
What kind of electronic communication might commonly be affected by citizen journalism?
grigory [225]

Answer: Don't got three explanations don't know a lot but here.

Explanation:

"Citizen journalists cover crisis events using camera cell phones and digital cameras and then either publish their accounts on the Web, or exchange images and accounts through informal networks. The result can be news in real-time that is more local and informative."

6 0
3 years ago
What is the purpose of linking text boxes?
Neko [114]
The answer that the person answered is the same answer I was gonna answer so Yh it’s correct
5 0
3 years ago
Provide examples of the cost of quality based on your own experiences
Phoenix [80]

Answer:

Cost of quality is define as methodology which basically decide the cost of product and services in an organisation and company. It also determine all the cost which are associated with the quality.

The cost of quality basically divided into four categories that are:

  • Appraisal
  • Prevention
  • External failure
  • Internal failure

Example of the cost of quality is that, in oil refinery industry if the growth of product increased then, the company state also increased. In same way, if there is decrease in the refining state of the product then, the growth of product automatically reduced.

3 0
3 years ago
Other questions:
  • Janelle is organizing an outline for an investigative report about the benefits of taking a 30-minute walk each day. which of th
    11·2 answers
  • "The pkill command terminates _________."
    14·1 answer
  • Write a program that asks the user for the name of a text file. the program should display the last 10 lines of the file on the
    13·1 answer
  • Which is true about POP3 and IMAP for incoming email?
    10·1 answer
  • Which one is a certain sign that a website is not reliable?
    6·2 answers
  • The design of a blog refers to:
    8·1 answer
  • How 0x86 processor store 0x12345678 in memory ​
    13·1 answer
  • The Brinley website will not let me search for questions anymore. It says “Search all you want in-app” and then covers the quest
    14·1 answer
  • What would your leadership style be?
    14·1 answer
  • Which of the statements below are true? Which are false?
    14·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!