Ch2_4_s5

Ch2_4_s5 - ; cin >> variable1 ; or...

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

View Full Document Right Arrow Icon
Chapter 2.4: Input/Output 1 Next Slide Previous Slide Prompting for keyboard data To know what data to enter from the keyboard, a program will use a cout statement to "prompt" (i.e. ask) for the data, followed by a cin statement for input of the data. For example: cout << "Please enter variable1 here: “
Background image of page 1
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: ; cin &gt;&gt; variable1 ; or cout &lt;&lt; &quot;Enter your age and weight, separated by a space : ; cin &gt;&gt; age &gt;&gt; weight ; or cout &lt;&lt; &quot;Enter your age and weight\n\nAge = &lt;&lt; endl ; cin &gt;&gt; age ; cout &lt;&lt; &quot;Weight = ; cin &gt;&gt; weight ;...
View Full Document

Ask a homework question - tutors are online