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

  Design and implement a text-based game

Design and implement a text-based game where the player movers through a series of rooms or spaces.

  Define methods and instance variables for the class

Your assignment is to create a sketch that defines a class called "Tribble". A Tribble is a small fuzzy creature kept as a cute pet that breeds quickly.

  Definition of data mining

In the Data Mining the first step to address this question is to carry out the appropriate research through the Web. Utilizing what you have found on Web, address the following questions in detail. To receive the full credit, you should supply URL..

  Write an application that extends jframe

Write an application that extends JFrame and that displays a yellow smiling face on the screen. save file as JSmileFace.java

  Research which is better or more secure ssl or tls

Research which is better or more secure SSL or TLS - explain and justify your position. Include which one you use today and plan on using tomorrow.

  Write down a program that requests an integer

The Twelve Days of Christmas. Each year, PNC Advisors of Pittsburgh publishes a Christmas Price List. See Table 6.11. Write a program that requests integer from 1 through 12 and then lists the gifts for that day along with the day's cost.

  Discuss effective average access time of the memory system

When a CPU writes to the cache, both the item in the cache and the corresponding item in the memory must be updated. If data is not in the cache.

  Explore how video games are being used by medical community

For this writing assignment, you will explore how video games are being used by the medical community. Video games (both online and apps) are a source of entertainment for individuals and groups of people.

  Debate the major pros and cons of implementing such a policy

Many companies, large and small, have implemented Bring Your Own Device (BYOD) policies allowing employees to use their personal smartphones and tablets.

  What are some of the opportunities and challenges associated

The Consumer Electronics Show opened in January in Las Vegas. One of the major themes of the show was putting "intelligence" into physical products.

  Discuss has facebook solved the mobile ad problem

By allowing instant access to information, online purchases, a camera, and social media, our smartphones have become a part of our daily routines

  Write a client program that uses stack abstract data type

Write a client program that uses the Stack abstract data type to simulate a session with a bank teller.

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