samedi 25 avril 2020

How to get valid Input by using these functions?

I am C++ beginner and I have given a task from university to complete this task I have this short note of functions. I need it in c++ and in c#

1: Declare variable for input

2: Prompt to enter the The Number to start Calculator

3: Get Input

4: Create decision with bool

5: Declare Variable with value 0 to hold the bad input

6: Create checking_1 variable to verify if the value of array [0] of main input is 0

7: shout the decision_1 to false if the value of array [0] is 0 in main input

8: Create for loop with checking_2 variable with value 0, and compare with the main input length, if the length of main input is greater then make conjunction with decision and increment checking_2 until the value is not matched to verify the valid number input.

9: Create an if function to help the for loop to verify the numbers, so in main input will be conjunction between checking_2 and all numbers by using the negation ! logic >='0' and <='9'.

10: shout the decision to false if the input is invalid and the decision is already set to true if the input is valid.

11: Create an if function to console out if the input was valid else invalid.

Aucun commentaire:

Enregistrer un commentaire