How do you write a while loop or a for loop

Assignment Help Computer Engineering
Reference no: EM132201291

How do you write a while loop or a for loop that ONLY takes positive intergers? the interger has to be greater than or equal to 3.

This is what I had until I realized if I enter anything thats not a number it goes into an infinite loop.

int input;

cout << "Enter an integer : ";

cin >> input;

while (n < 3) //while number < 3, ask to re-enter

{

cout << endl;

cout << "Integer must be >=3 . Try again ";

cin>>input;

}

Reference no: EM132201291

Questions Cloud

Perform the division and displays the quotient : Write a LC-3 assembly program to perform division. The integers (between 1 and 9) for the division are provided by the user in response to a prompt.
Write a java sorting application with two classes : Your JavaSort Class, as a minimum must contain sorting methods for BubbleSort, InsertionSort, ShellSort, MergeSort, and Quicksort.
Displays repeated lines only in a file named employees : Displays the lines in a file named employees that are not repeated. Displays repeated lines only in a file named employees.
Find the largest and smallest of n non-zero positive integer : Write the LEGv8 assembly code to find the largest and smallest of n non-zero positive integers.
How do you write a while loop or a for loop : How do you write a while loop or a for loop that ONLY takes positive intergers? the interger has to be greater than or equal to 3.
Create one function for input and output : Use the search method to determine zones around possible solutions and then find the root within that zone using the bisection method.
Develop a function to equalize the histogram of the color : Convert the color image ‘Baloon.tif' into HSV color space using function rgb2hsv and display each channel separately.
Create a general symmetric moving average filter : The code should create a plot to displays both the filtered and the unfiltered data on the same graph?
Perform a time analysis counting each basic operation : Write a loop in c++ to add up the sum of integers from 1 to n and perform a time analysis counting each basic operation

Reviews

Write a Review

Computer Engineering Questions & Answers

  Write down a c program that takes an integer argument

Write a C program that takes an integer argument from command line and outputs the sum of all digits of the integer. For in case , the result of the invocation sum of digits 12345 should be 15.

  How you invoke predefined function and user-defined function

List the similarities and differences between how you invoke (call) a predefined (that is, library) function and a user-defined function.

  Calculate the costs associated with a loan

To calculate the costs associated with a loan, such as the one that Bob and Carol need to start their winery, you must have the following information The annual interest rate.

  Design a powerpoint presentation based on the scenario

design a PowerPoint presentation based on the scenario. You have been asked to present tips on time management skills to new students at an online university. Your group will work together to organize and create a presentation with your advice.

  What are the capabilities of odd parity

How many bits are needed to uniquely represent a code that includes.

  Discuss how forensic investigators can find evidence

Discuss how forensic investigators can find evidence on acquired computers

  What is the functionality of the utility program trace route

Compare TCP and UDP. What is the functionality of the utility program ping? What is the functionality of the utility program Trace route?

  Using a while structure for designing pseudocode

By using a WHILE structure for designing the pseudocode in order to prepare a monthly report for the legal clinic.

  Preliminary design model, and a logical model of the system

Can you advise me on what a Preliminary Design Model, and a Logical Model of the System are. Can you please point me or show me examples of these two models.

  Demonstrates how method versions can be called

Create an application that demonstrates how both method versions can be called.

  How has the microchip contributed to knowledge revolution

What is the relationship between the changes in technology and the socioeconomic changes? What drives this change?

  Write a program using the above function to print the number

Write a program using the above function to print thr number of days from 1 Jan 2017 to a given date and the day of the week of the given date.

Free Assignment Quote

Assured A++ Grade

Get guaranteed satisfaction & time on delivery in every assignment order you paid with us! We ensure premium quality solution document along with free turntin report!

All rights reserved! Copyrights ©2019-2020 ExpertsMind IT Educational Pvt Ltd