Wim
Why would they ban you?
MᏫᎻᎯᎷᎷᎬᎠ
no
Of course
Ибраги́м
Maybe wrote that when he was 15
Prometheus
Why would they ban you?
I’m a horrible person.
Wim
Me too but I'm still here?
Prometheus
Me too but I'm still here?
I’m worse. Trust me lol
Wim
Everytime they see that I'm typing people already start to cringe
Wim
Nah you only have Kim issues
Wim
😂
Prometheus
Kim?
Wim
Wim
The fatzo from NK?
Prometheus
Oh. Rocket man. We’ll bring freedom to NK. Don’t worry about that.
professor
is it possible to join multiples loop into one without having i+j+z I mean only one var at the end joining loops for (int i = 33; i <= 47; i++) std::cout << (char)i; for (int j = 58; j <= 64; j++) std::cout << (char)j; for (int z = 91; z <= 96; z++) std::cout << (char)z;
Farhan
Why we give flag as 0 ?
Farhan
Sorry initialise
Dima
What?
BinaryByter
professor
just a simple question , why do I always get 45 from return value? int Common::digits() { int digits = 0; for (int i = 0; i <= 9; i++) { digits += i; } return digits; }
professor
I just want to store it in the variable and return it , but how can I ?
professor
I mean I want to loop from 0 to 9 without sum , but I want to store it in the digit var to return it
S.
just use a variable to store the return value?
S.
anyway you question is not clear enough
Pavel
I mean I want to loop from 0 to 9 without sum , but I want to store it in the digit var to return it
Return what? You can only return a single value out of a call. You can call some function in the loop if you want to do some action for each value. Or you can make an std::vector to accumulate and return all the values. Or you can use std::function if you want to make a generic "for each" function and parametrize the call with some behavoior
professor
Return what? You can only return a single value out of a call. You can call some function in the loop if you want to do some action for each value. Or you can make an std::vector to accumulate and return all the values. Or you can use std::function if you want to make a generic "for each" function and parametrize the call with some behavoior
int Common::digits() { int digits = 0; for (int i = 0; i <= 9; i++) { digits += i; } return digits; } I got my function like this , but however if in my main std::cout << reverse.digits(); then my output it should 0123456789 ,but it return the sum
Pavel
Also there are STL algorithms to generate ranges of values like std::generate
Pavel
It's not a string concatenation, that you're looking for
professor
how can I fix to display 0 to 9?
Pavel
how can I fix to display 0 to 9?
You need to have digits not as int but as std::string, and convert i to string before concatenation. Then you'll have a string that you want.
Pavel
There are many ways to convert int to string, e.g. std::to_string
professor
so I should need to return as a string even if I am dealing with numbers
Pavel
how can I fix to display 0 to 9?
Also the result of function should be a string
Pavel
so I should need to return as a string even if I am dealing with numbers
Or you can convert digits back to int before returning. But it will drop the leading zero of course
S.
🤦‍♂️
professor
I saw it
S.
why do you need that
professor
it return me ascii not numbers std::string Common::digits() { std::string digits; for (int i = 0; i <= 9; i++) { digits += i; } return digits; } std::cout << reverse.digits();
S.
this looks like a weird requirement
professor
yeap
Anonymous
Hi
Nikolas
Use a stringstream
Create a stringstream, add digits to it with the "<<" operator and then call .str() on the stringstream to get the string
S.
return a “0123456789” directly ( why not
Pavel
it return me ascii not numbers std::string Common::digits() { std::string digits; for (int i = 0; i <= 9; i++) { digits += i; } return digits; } std::cout << reverse.digits();
Here you append numbers to string, it's not how you should do it. It should be converted to string before addition. Or better yet use stringstream as Nikolas said
Pavel
If add int to string directly, as I remember it will be casted to char, which basically something like saying "add a character with this index from ASCII table". That's not what you want probably
Mat
We can use recursion
Recursion is a waste of resources in that case
数学の恋人
Recursion is a waste of resources in that case
Anyhow I thought of other way around to do that specefic problem
数学の恋人
so now no need
数学の恋人
Also now I understand that there is no other way to do that also
Ming
Or what, Red?
数学の恋人
Or what, Red?
What do you mean?
Ming
How to do the problem
Dima
I don’t think this is allowed to post
Ludovic 'Archivist'
And also have enough grammar and syntax errors for me not to understand it without parsing it twice
Ludovic 'Archivist'
alternatively, use a better parsing aplroach
No chance that I start parsing novlang anytime soon
BinaryByter
😂😂😂
Ming
What is your favourite c++ project?
Wim
i do trios in my nests too, but co call my business after that?
Anonymous
Hi I m new comer.. so I want to learn c with u
Wim
Virtual robots? And what are you looking here for?
数学の恋人
How to do the problem
Oh the problem was really easy. It was You are given a number, say 659876 now you have to return the number by adding one to each digit of the given number. i.e., Input: 659876 Output: 7610987
klimi
/warns
MᏫᎻᎯᎷᎷᎬᎠ
Rose is in a coma
Oleg
Hello! why #define can't help with multiple definition of ?
Dima
You have to undef first I guess if I got the question right
Oleg
e.g. #ifndef COMMANDS_H_ #define COMMANDS_H_ void f123() {}; #endif