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
WWW is used to browse for view the webpage basically content is normally displayed as HTML pages.
In any browser's webpage irrespective of language been used output content display as HTML pages only.
<u>Explanation:</u>
- In other methods is used XML format where it is opened and closed tag for every word editing XML file is very useful.
- XML tools are ready is available where end-user can edit or create by for example notepad++ extra
- It is a language designed to store the data in a specific format and easily process and used by a coding language or web pages.
Answer:
The answer is "Option 1"
Explanation:
In oops(object-oriented programming language) an object is an example of a specific class or subclass with methods or processes of the class itself and variables for data. When we create an object of the class the default constructor is automatically executed. and other options are not correct that an be described as follows:
- In option 2, Type is used in data type. It is an attribute, that tells the user or programmer what kind of data value they store. for example string, numeric, and floating-point value.
- In option 3, Parameter is used in the method for passing a value in function and calculate some values.
- In option 4, A method is also known as a procedure, that associate with a message and an object.
Big difference
Loops allow you to execute code multiple times while a condition is true
Functions allow you to “call” a snippet of code whenever you want, and you can pass it arguments that could affect the data it returns