Lecture 5
Function from last lecture
# include <iostream>
using namespace std;
int main() {
int x,y; cin >> x >> y; // read two integers from cin, skipping whitespace
cout << x+y << endl; // reads whitespace delimited input
} Failure to Read Int
Example 1:
There is an implicit conversion from cin to bool:
>>
>>Rewrite Example 1:
Example:
Example
Strings
Initialization
String Operations
Example
Reading with whitespace: getline(cin, s)
getline(cin, s)File Access
Last updated