Anonymous
something is wrong in the code
Anonymous
Write a program that will get all the prime numbers that were written before that number in the input. The numbers displayed must be separated by a space
Anonymous
hello?
klimi
hello?
Hello.
数学の恋人
what's the return type of std::basic_string::size ? If I am not wrong I think it's std::uint64_t please correct me if wrong
Anonymous
Hello.
I can’t write this code, please write you
数学の恋人
Alex
I can’t write this code, please write you
I suppose its good idea to ban guys like this
Alex
who asks write code, look for errors in code etc
Mp
can anyone help me??
Anonymous
Hello.
😔but why am I trying but nothing i am a girl
数学の恋人
😔but why am I trying but nothing i am a girl
what you think that kind of thing will work here, miss?
klimi
😔but why am I trying but nothing i am a girl
Oh I didnt know you're a girl! That changes everything
数学の恋人
hmm... because at all places they were showing like numbers of charT elements in the string
数学の恋人
or like size_type
数学の恋人
or like size_type
this I think is just notation
klimi
https://en.cppreference.com/w/cpp/string/basic_string/max_size
数学の恋人
https://en.cppreference.com/w/cpp/string/basic_string/max_size
lol not that, but I think in my case it'll turn out uint64_t
Mp
anyone knows c++?
Mp
please answer?
klimi
lol not that, but I think in my case it'll turn out uint64_t
Well the max size would man what the variable type is no?
klimi
anyone knows c++?
Like nearly everyone in this group - people who have just interest but they dont want to learn
Pavel
I can’t write this code, please write you
what the purpose of doing the assignments you are sending to us? 1) to learn? then you should do them yourself and try to understand how it is working and why (we can answer questions about "how" and "why" if you are able to ask them). 2) just to copypaste our solutions and pass the assignments? well, then you've chosen the wrong place
Anonymous
you're right
数学の恋人
what's the return type of std::basic_string::size ? If I am not wrong I think it's std::uint64_t please correct me if wrong
actually it's like this, std::string some_func(std::string text) { int j = 2; // I already know that text.size() > 5. auto x = text.size() - 2; return text.erase(4, 1);
Anonymous
I will try
数学の恋人
I will try
read about Sieve of Eratosthenes in your case at least for that problem
Brax
Brax
Give it a shot buddy!
数学の恋人
BTW they say using unsigned data types should be avoided, I know reason, but should I still avoid even if I know that none of the value (be it anything) is going to be less than 1, let alone negative
数学の恋人
https://stackoverflow.com/questions/22587451/c-c-use-of-int-or-unsigned-int
数学の恋人
https://www.learncpp.com/cpp-tutorial/unsigned-integers-and-why-to-avoid-them/
Alex
It's generally laziness or lack of understanding. I aways use unsigned int when the value should not be negative. That also serves the documentation purpose of specifying what the correct values should be.
Alex
from your link
Pavel
BTW they say using unsigned data types should be avoided, I know reason, but should I still avoid even if I know that none of the value (be it anything) is going to be less than 1, let alone negative
when it can be error-prone to do some stuff with unsigned, they are OK in cases when you sure that they can never be underflowed (and preferably you have good static code analysis that can prove that).
数学の恋人
it's all strings mainly
Alex
for example size_t is unsigned
数学の恋人
for example size_t is unsigned
so this one should be all fine right? Sorry to make you look through that
Pavel
so this one should be all fine right? Sorry to make you look through that
by the way, you can do something like using string_size_type = std::string::size_type; and use string_size_type instead of std::uint64_t.
Pavel
otherwise the real size type can be different on some other platform than you use now
Anonymous
what's the return type of std::basic_string::size ? If I am not wrong I think it's std::uint64_t please correct me if wrong
std::basic_string is a template. if you mean std::string (basic_string<char>), then the return type is std::string::size_type
Anonymous
so this one should be all fine right? Sorry to make you look through that
btw this entire function can be simplified to text.erase(std::stable_partition(text.begin(), text.end(), std::isalpha), text.end());
Anonymous
don't write Turbo C++ code. come to the modern age
Dima
don't write Turbo C++ code. come to the modern age
At least there are no graphics.h and conio.h :D
Anonymous
Oh thanks, i knew about isalpha i wonder why i didn't use it there
actually sorry that's not enough. you still need to transform (std::transform, std::for_each, range based for loop) the entire thing to uppercase. lemme see if that is possible to do that with a one-liner.
Anonymous
so this one should be all fine right? Sorry to make you look through that
ye i guess this is faster than using 2 algorithms
Sameer
Sameer Khan, Hello guys , I want to know more about enum can anybody explain me in detail please help me. Sameer Khan, Please🙏🙏
Anonymous
I think in most or all implementations it's the same as std::size_t
Mp
how to integrate with monte carlo method
Mp
what? why i gave warning?
Anonymous
Anonymous
what? why i gave warning?
* Personal messages without asking beforehand are not allowed.
Anonymous
Sameer Khan, Hello guys , I want to know more about enum can anybody explain me in detail please help me. Sameer Khan, Please🙏🙏
https://en.cppreference.com/w/c/language/enum https://en.cppreference.com/w/cpp/language/enum
piggyho
please answer?
apparently no one here
Sameer
https://en.cppreference.com/w/c/language/enum https://en.cppreference.com/w/cpp/language/enum
Actually I have seen it but what is the use of that I don't know that bro can you help me on that
Sameer
Bro what where in can use that??
Anonymous
Bro what where in can use that??
lmao that's up to you and what you are doing
piggyho
Actually I have seen it but what is the use of that I don't know that bro can you help me on that
it will answer your question. you just have to try a little bit. or is this a homework question and copying from cpp reference is too obvious
Sameer
lmao that's up to you and what you are doing
But that the my question where I can like if I have to assign the variable first so I can make the array and do that.
Sameer
Like : enum director { A1, A2, A3}d1; Int main() { Int A1= 0; Int A2 = 1 ; Int A3 = 3 ; }
Anonymous
sorry