We use cookies to ensure you have the best browsing experience on our website. Please read our cookie policy for more information about how we use cookies.
- Prepare
- C++
- Strings
- StringStream
- Discussions
StringStream
StringStream
Sort by
recency
|
518 Discussions
|
Please Login in order to post a comment
include
include
include
include
using namespace std; vector numbers; string read; string num;
int main(){ getline(cin,read); stringstream ss (read); while (getline(ss,num, ',')){ numbers.push_back(num); } for (string i : numbers){ cout << i << endl; } return 0; }
include
include
include
using namespace std;
vector parseInts(string str) { int a; char ch; vector integers; stringstream ss(str); for (int i = 0; i < str.size()+1; i++) { if (str[i] == ',') { ss >> a >> ch; integers.push_back(a); } } ss >> a >> ch; integers.push_back(a); return integers; }
int main() { string str; cin >> str; vector integers = parseInts(str); for(int i = 0; i < integers.size(); i++) { cout << integers[i] << "\n"; } return 0; }
My c++ code of Clash of Clans
INCLUDE using namespace std; int main() { int choice; cout << "Enter a number (1-3): "; cin >> choice;
}
My C++ code of Entertainment,movies
include
include
using namespace std;
// Function to display an entertainment message void entertainUser(const string &link) { cout << "Looking for premium entertainment? Check out: " << link << endl; }
int main() { string input; cout << "Enter your favorite entertainment genre: "; cin >> input;
}