COMP2113
COMP2113_ENGG1340 Programming technologies and Computer programming II [Section 2BC] [2023]
Loading...
Searching...
No Matches
string_getline.cpp
Go to the documentation of this file.
1
#include <iostream>
2
#include <string>
3
using namespace
std;
4
5
int
main
()
6
{
7
string
s;
8
cout <<
"Please input a sentence: "
<< endl;
9
getline(cin, s);
10
cout <<
"s = \""
<< s <<
"\"\n"
;
11
12
13
cout <<
"Input 2 comma-separated phrases: "
<< endl;
14
getline(cin, s,
','
);
15
cout <<
"1st phrase = \""
<< s <<
"\"\n"
;
16
17
return
0;
18
}
main
int main()
Definition
string_getline.cpp:5
Module6
Sample Code
Part III - C++ Strings
string_getline.cpp
Generated on Sun Sep 29 2024 16:39:53 for COMP2113 by
1.12.0