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
Brrunno [24]
3 years ago
14

You will include code that will validate all user input. If the user inputs an invalid value, the program will respond with an e

rror message and will ask the user to input the data again (use a do / while loop). Invalid values include:
Computers and Technology
1 answer:
alukav5142 [94]3 years ago
8 0

Answer:

See explanation (Program written in C++)

Explanation:

The question is incomplete as the invalid values were not included in the question.

However, to make the sense of it, I'll answer your question using the following conditions.

1. Invalid values include: Numbers less than 0 (See comments for explanations)

#include <iostream>

using namespace std;

int main() {

//This line declares num (for user input)

int num;

//The following iteration keeps repeating itself until a number greater than 0 is entered using do while loop

do{

//This line prompts user for input

cout<<"Numbers greater than 0: ";

//This line gets input from the user

cin>>num;}

while(num<1);//This condition checks for valid user input

cout<<"You entered: "<<num; //This line prints out the user input

}

2. Invalid values include: Odd Numbers

I'll make use of the above code (in 1)

Start by replacing:

cout<<"Numbers greater than 0: ";

with

cout<<"Even Numbers: "; //This prompts user for even numbers

Replace

while(num<1);

with

while(num%2==1); //This checks if input is odd. If yes, the loop is repeated

3. Invalid values include: Even Numbers

I'll make use of the above code (in 1)

Start by replacing:

cout<<"Numbers greater than 0: ";

with

cout<<"Odd Numbers: "; //This prompts user for Odd numbers

Replace

while(num<1);

with

while(num%2==0); //This checks if input is even. If yes, the loop is repeated

You might be interested in
Can some one help me answer this question plz
sergij07 [2.7K]

Answer:

In mathematics and digital electronics, a binary number is a number expressed in the base-2 numeral system or binary numeral system, which uses only two symbols: typically "0" (zero) and "1" (one). The base-2 numeral system is a positional notation with a radix of 2. Each digit is referred to as a bit, or binary digit.

Explanation: and the key to reading binary is separating the code into groups of usually 8 digits and knowing that each 1 or 0 represents a 1,2,4,8,16,32,64,128, ect. from the right to the left. the numbers are easy to remember because they start at 1 and then are multiplied by 2 every time.

5 0
3 years ago
Teachers can organize the classroom environment to facilitate activities and to prevent problems. True Or False
Gennadij [26K]

Answer:

True

Explanation:

It is possible to organize a classroom environment to promote social interaction and minimize potential points of stress

6 0
3 years ago
What is the program that searches through data bases?
german
If i'm right its call: Algorithm
5 0
3 years ago
If we develop a new policy for our environment that requires us to use complex and automatically generated passwords that are un
stepan [7]

Answer:

The answer is "Login complexity will be increased very exponentially".

Explanation:

In computer science, The password is also known as a series of characters, which allows you to use the validation process to validate any customer's privacy.  

  • It is normal usage of passwords that work together with a username to make it, it only accessible by the user, and to give the user accessibility to a computer, software or web page.
  • If the password is more complex so, it is hard to learn, and it also provides login complexity, that's why we must use a less complex password.
7 0
3 years ago
Words or names defined by the programmer are called
polet [3.4K]
<span>Words or names defined by the programmers are called as programmer defined symbols or identifiers. These are called as variables which are just simple storage locations and making available for the program to use. No two variables are same in the code of the program.</span>
6 0
3 years ago
Other questions:
  • After Intel faced strong shifts in technologies, such as cloud services, social networking, mobile devices, etc., Intel realized
    11·1 answer
  • A user would like to format an arrow that has been inserted into a chart. What is the most efficient method for completing this
    9·1 answer
  • It is safe to stand on the top step of a ladder provided it is braced property
    10·1 answer
  • If object B inherits from object A, then which of the following statements is true?
    15·1 answer
  • An administrator has several cables plugged into a patch panel and needs to determine which one comes from a specific port. Whic
    15·1 answer
  • Worth 30 pts
    9·2 answers
  • Katla is a project manager. One of the programmers on her team comes to her and says that he permanently deleted some code mista
    5·1 answer
  • False
    8·1 answer
  • Aarti, a museum employee, has created a table in access titled “Roman Achitecture”. She has included a field that links users im
    8·1 answer
  • When you run your Windows Form application, what is the lifespan of a global variable (also known as a "field" or "class" variab
    13·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!