Page Menu
Home
c4science
Search
Configure Global Search
Log In
Files
F78919365
ch-01-ex-02-solution.cpp
No One
Temporary
Actions
Download File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Subscribers
None
File Metadata
Details
File Info
Storage
Attached
Created
Fri, Aug 23, 18:21
Size
709 B
Mime Type
text/x-c
Expires
Sun, Aug 25, 18:21 (1 d, 23 h)
Engine
blob
Format
Raw Data
Handle
20122042
Attached To
R9360 PCSC_git
ch-01-ex-02-solution.cpp
View Options
/*
* exercise-02.cpp
*
* Read two integers from the keyboard and write their product on the screen.
*
* Created on: Jul 26, 2012
* Author: Radu Popescu <radu.popescu@epfl.ch>
*/
#include <iostream>
int
main
(
int
argc
,
char
*
argv
[])
{
// Read the two numbers from the keyboard
std
::
cout
<<
"Please input the first number. a= "
;
// Declare an integer variable and read a value from the keyboard
int
a
;
std
::
cin
>>
a
;
std
::
cout
<<
"Please input the second number. b= "
;
// Same thing for the second number
int
b
;
std
::
cin
>>
b
;
// Compute and print the product;
std
::
cout
<<
"The product of "
<<
a
<<
" and "
<<
b
<<
" is: "
<<
a
*
b
<<
std
::
endl
;
return
0
;
}
Event Timeline
Log In to Comment