primes1 - #include #include #include...

Info iconThis preview shows pages 1–2. Sign up to view the full content.

View Full Document Right Arrow Icon
#include <iostream> #include <cstdlib> #include <iomanip> using namespace std; int lower_limit; int lower_limit2; int higher_limit; int higher_limit2; int n; int negative_lower_limit; int negative_higher_limit; int num_primes; int num_non_primes; int main() { //prompt user to input a lower limit cout << "Enter lower limit (-100 to 100): " ; cin >> lower_limit; //if the lower limit has an absolute value greater than 100, allow them to re-enter if (abs(lower_limit) > 100) { cout << "Please enter a lower limit within the range (-100 to 100): " ; cin >> lower_limit; { if (abs(lower_limit) > 100) exit (0); //exit program on 2nd invalid entry } } //prompt user to input a upper limit cout << "Enter upper limit (-100 to 100): " ; cin >> higher_limit; //if the upper limit has an absolute value greater than 100, allow them to re-enter if (abs(higher_limit) > 100) { cout << "Please enter a lower limit within the range (-100 to 100): " ; cin >> higher_limit; { if (abs(higher_limit) > 100)
Background image of page 1

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
Image of page 2
This is the end of the preview. Sign up to access the rest of the document.

This note was uploaded on 03/18/2008 for the course CMPSC 101 taught by Professor Drobish,renee during the Fall '07 term at Penn State.

Page1 / 3

primes1 - #include #include #include...

This preview shows document pages 1 - 2. Sign up to view the full document.

View Full Document Right Arrow Icon
Ask a homework question - tutors are online