assignment19 - using namespace std int main int numExs...

Info iconThis preview shows page 1. Sign up to view the full content.

View Full Document Right Arrow Icon
/* Write a program that asks the user for a number between 1 and 10, then prints a line  of that many X as shown below. Reject any entries outside of the range of 1 to 10 by displaying      Entry is       out of range.  You must use a FOR LOOP for this problem. The variable used to store the number of   Xs must be called  numExs.*/  #include <iostream>  #include <string> 
Background image of page 1
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: using namespace std; int main () { int numExs; string totalxs; cout << "Please enter the number of Xs (1-10): "; cin >> numExs; if (numExs >= 1 && numExs <= 10) { int total = 0; for (int x = 1; x <= numExs; x++) cout << 'X'; cout << endl; } else { cout << "Please follow the directions! " << endl; } }...
View Full Document

This note was uploaded on 01/11/2010 for the course CMPSC 101 taught by Professor Drobish,renee during the Summer '07 term at Penn State.

Ask a homework question - tutors are online