Message from C, C++ talks

October 2020

— OwO

— Nice

— /ban

— Another one bites the dust...!
Banned Andrew.


Is there function like split() on c++ ?
i need to read space seperated ( or comma ) input into a list
i couldnt find one

— You can write it using stringstream and std::getline

— I got one, but its a big code to do this small operation

— Then you did it wrong

— It's literally like 5 lines of code

— Can you show 🤔

— Https://

— It's really not. He's referring to the solution I've sent him, which solves the entire problem he wants to solve

Message permanent page

— But he wants Python-like usage of lines, or something


#include <vector>
#include <string>
#include <iostream>

using std::vector;
using std::string;
using std::cout;

int main (void)
//std::string s = "452 5024 0422";
std::string s;
std::getline (std::cin, s);

std::string delimiter = " ";

vector<int> numbers;
size_t pos = 0;
std::string token;
int aux;
while ((pos = s.find(delimiter)) != std::string::npos) {
token = s.substr(0, pos);
aux = std::stoi(token);
s.erase(0, pos + delimiter.length());
aux = std::stoi(s);

std::cout << "The numbers are: " << '\n';
for (int number : numbers)
std::cout << number << '\n';

return 0;

Message permanent page

— My concern is the size of the binary compiled by the programming language.

I will try to figure out the speed later when i really learn how to program.

Also, apart from the program fitting on a floppy disk, I want it to be a videogame. That's why I want to learn programming.

Also, Unity is bloated. My computer has 2 GB of RAM and 1.10 GHz of processing power, yet for some reason it's 64-bit.

Message permanent page