StringPrompt

StringPrompt - n = getIntWithPrompt(prompt) ; } return n ;...

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

View Full Document Right Arrow Icon
#include <iostream> #include <cassert> using namespace std ; int n ; cout << prompt ; cout << ": " ; // or endl cin >> n ; assert (cin) ; return n ; } int n = lower - 1 ; while (n < lower || n >> upper) {
Background image of page 1
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: n = getIntWithPrompt(prompt) ; } return n ; } int main() { string myPrompt = &quot;Enter an integer value between 1 an 10&quot; ; int value = getIntWithPromptAndRange(myPrompt,1,10) ; cout &lt;&lt; &quot;Our number is &quot; &lt;&lt; value &lt;&lt; &quot;.&quot; &lt;&lt; endl ; cout &lt;&lt; &quot;The prompt was \&quot;&quot; &lt;&lt; myPrompt &lt;&lt; &quot;\&quot;.&quot; &lt;&lt; endl ; }...
View Full Document

Ask a homework question - tutors are online