-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy path1string.cpp
More file actions
40 lines (33 loc) · 722 Bytes
/
1string.cpp
File metadata and controls
40 lines (33 loc) · 722 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
// String Class
#include<iostream>
#include<string>
#include<vector>
using namespace std;
int main(){
// Method-1
// char s[1000] = {'1','a','b','c','\0'};
// Method-2
// string s="Hello World"; //Dynamic Array - Size can be Change acc. to Demand(Run Time).
// Method-3 : By Calling the Function
// string s=("Hello World");
// Method-4
string s;
int n=5;
vector<string> sarr;
string temp;
while(n--){
getline(cin,temp);
sarr.push_back(temp);
}
/*getline(cin,s,'.');
for(char ch : s){
cout<<ch<<",";
}
cout<<s<<endl;
// vector<string>...
*/
for(string x : sarr){
cout<<x<<","<<endl;
}
return 0;
}