Njabu
Oh thanks, I was asking maybe someone can help me, I don't have any Idea
Njabu
Thanks , I won't send again
Sandeep
what you wrote is the same as this
Why should the size of a stack array be specified at compile time??
Hermann
How serialize and deserialize my std deque without boost?
Anonymous
## Rules #pinned * You are not entitled to an answer, getting angry about not answered questions will get you warned. * Not checking your problem in google (or any other search engine) first will get you a warn. * Asking to solve an assignment/test/whatever without trying it first yourself will get you a warn or will get you BANNED. We won’t write a code for you, but we can push you forward and suggest something. * Before posting a long code snippet think twice and read the Resources section below. * No “best book” or “best youtube channel” requests, use /get cbook and /get cppbookguide chat commands. * No “best ide” requests, use /get ide chat command to see the suggestions. * Asking for something that is in the pinned message right after joining WILL GET YOU BANNED. * C/C++ discussion preffered (assembly also allowed), asking about other languages (or groups for other languages) right after joining will get you BANNED. * Reverse enginnering, hacking and related topics are allowed, but asking to hack facebook, instagram, etc. is NOT allowed. Also if you ask "how to become a hacker" and obviously have zero knowledge on anything related to that you may get warned or banned. * Legitimate requests for help on code and programming questions are welcome. A request is considered legitimate if it describes your problem, what you've done so far and what went wrong. Requests such as "write my program" or "do my homework" are never considered legitimate. Asking not legitimate questions will result in a warn or ban. See https://stackoverflow.com/help/mcve on how to write good questions. * Asking for book recommendations is ok, but "pls give pdf book" is not allowed, find books by yourself. Posting illegally copied books (or links to those books) is also not allowed and will get you BANNED. * Only English language is allowed, if you speak shitty English or don't understand anything in English YOU WILL BE BANNED. * A little bit of programming related memes, jokes, shitposting are allowed. * NSFW content (porn, nudity, etc.) is not allowed. * Spamming/advertising (job posts are also ads, so ask an admin before posting) will grant you a warning or an immediate ban if you do it right after joining. * Religion, politics and ideological topics are forbidden. * Long code snippets must be posted via a snippet website(links below), posting pictures of code and posting long snippets in the group is not allowed. * If you encounter a problem, while using dev C++ or turbo C/C++, you will not be helped, use another more modern IDE. * Don't post compiled executables, that is obviously a security risk. * Personal messages without asking beforehand are not allowed. * If you want to post a link or some article in this chat you will need an admin approval first ## Resources C/C++ group India: http://t.me/c_cpp_india About asking good questions: * [English](http://www.catb.org/esr/faqs/smart-questions.html) * [Translations](http://www.catb.org/esr/faqs/smart-questions.html#translations) For posting long code snippets: * [GitHub Gist](https://gist.github.com) * [Ubuntu Paste](https://paste.ubuntu.com/) * [Pastebin](https://pastebin.com) ## Reports If you notice any forbidden content, please use the /report command while responding to the offending post to report it to the admins.
Do not reply out of context for bringing attention. can you add it to the rules, please?
Anonymous
why is it bothering you?
because it's annoying
Anonymous
/warn @Den_dan1 PMing
Andrew
how to get the current OS at runtime in C++, something like if (os == "linux") { do this}
Anonymous
If you can compile-time
Andrew
i have to generate some files based on the current os
сумбула
is there are any standard function in c++ that converts binary to decimal or vice versa?
сумбула
Binary to decimal what?
binary number to decimal number conversion
Anonymous
Anonymous
binary number to decimal number conversion
You want to get a binary string for a number?
сумбула
like in binary 00001100 is equal to 12 in decimal
Anonymous
yeah
std::from_chars std::to_chars
Andrew
like in binary 00001100 is equal to 12 in decimal
std::bitset<numbits>(number)
сумбула
thank you
Symphorien
Hi everyone I hope you're all doing well
Shadow
Good notes for DSA c++?
Shadow
Any recommendations?
armandofsanchez
how to get the current OS at runtime in C++, something like if (os == "linux") { do this}
Maybe try a system command to call de os (for example system(uname))
Anonymous
i have to generate some files based on the current os
You can use macro constant available for operating systems Like _WIN32
Anonymous
When I say: classname variable ....inside that class, that means what ?!
Shadow
std::from_chars std::to_chars
Std:: c++ ka hai kya?
Anonymous
Std:: c++ ka hai kya?
/warn non English
バレンタインがいない柴(食用不可)
Hi 🙋🏻‍♂️
バレンタインがいない柴(食用不可)
Im just to say hi here :P
Vaishnav
Anyone with c language notes and study materials
Hermann
how serialize and deserialize my deque<Base>>??
Hermann
https://pastebin.com/CWyMJLgH
Pavel
https://pastebin.com/CWyMJLgH
The simplest way, you can the write size of the deque to the stream and then serialize each element (as space separated values for example, if your string value can't contain spaces). When deserializing, first read the size, then read as many elements as the size
Marshall
Hi everyone! I'm a newbie. Can someone explain to me how in main function classes work? Thanks in advance! #include <iostream> #include <cassert> using namespace std; class Drob { int m_numerator; int m_denominatar; public: //Конструктоор по умольчанию Drob(int numerator = 0, int denominator = 1) : m_numerator{ numerator }, m_denominatar{ denominator } { //assert - обрабатывает ошибки assert(denominator != 0); } //Конструктор копирование Drob(const Drob& copy) : m_numerator(copy.m_numerator), m_denominatar{ copy.m_denominatar } { //Нет необходимости выполнять проверку denominator здесь, так как //эта проверка уже осуществлена в конструкторе по умольчанию cout << "Copy constructor worked here!\n";//Просто показать, что это работает } friend ostream& operator<<(ostream& out, const Drob& d1); int getNumerator() { return m_numerator; } void setNumerator(int numerator) { m_numerator = numerator; } }; ostream& operator<<(ostream& out, const Drob& d1) { out << d1.m_numerator << "/" << d1.m_numerator; return out; } Drob makeNegative(Drob d) { d.setNumerator(-d.getNumerator()); return d; } int main() { cout << makeNegative(7);//передаем целочисленное значение return 0; }
Marshall
I roughly know how it works. I just wanted to go deeper into this process
Anonymous
Anyone need help with c Questions ?
Pavel
I roughly know how it works. I just wanted to go deeper into this process
Well, what part of the code is interesting for you? because otherwise it's a lot to explain (and probably the things that you already know)
Pavel
Hi everyone! I'm a newbie. Can someone explain to me how in main function classes work? Thanks in advance! #include <iostream> #include <cassert> using namespace std; class Drob { int m_numerator; int m_denominatar; public: //Конструктоор по умольчанию Drob(int numerator = 0, int denominator = 1) : m_numerator{ numerator }, m_denominatar{ denominator } { //assert - обрабатывает ошибки assert(denominator != 0); } //Конструктор копирование Drob(const Drob& copy) : m_numerator(copy.m_numerator), m_denominatar{ copy.m_denominatar } { //Нет необходимости выполнять проверку denominator здесь, так как //эта проверка уже осуществлена в конструкторе по умольчанию cout << "Copy constructor worked here!\n";//Просто показать, что это работает } friend ostream& operator<<(ostream& out, const Drob& d1); int getNumerator() { return m_numerator; } void setNumerator(int numerator) { m_numerator = numerator; } }; ostream& operator<<(ostream& out, const Drob& d1) { out << d1.m_numerator << "/" << d1.m_numerator; return out; } Drob makeNegative(Drob d) { d.setNumerator(-d.getNumerator()); return d; } int main() { cout << makeNegative(7);//передаем целочисленное значение return 0; }
Two things that I would like to mention, the explicit copy constructor is not needed here. If it wasn't declared it will be generated anyway, and probably more efficiently. Implicit constructors are usually bad design choices, they may look handy but there are all kinds of weird bugs that follow.
Marshall
I'm interested. How does it work function Drob!
Pavel
I'm interested. How does it work function Drob!
Drob is a class, it has an explicit constructor from int. You call makeNegative passing an int, int being implicitly converted to Drob.
Pavel
Then there are functions called on it, then it being returned then operator << is being called on it to print it to cout
Senju
Does any one has competitive programming 4 Book 1 and 2
Senju
Pls DM It would be of great help... Thanks
Anonymous
Are there anyone use atom for c programming?
Earl B
But am switching to neovim
Anonymous
I use it
Can I asking something about the atom?
Earl B
Why haven't you asked already? Just ask the question
Anonymous
I'm getting an error while running the c programming code
Anonymous
Yes I have a gcc
Anonymous
I'm getting an error while running the c programming code
Atom is a text editor He has nothing to do with running your code
Anonymous
Provide WHOLE information to get help
Atropos
Yes I have a gcc
compile & run your code directly from terminal
Anonymous
I did it but there are an error
Atropos
I did it but there are an error
so, paste the full error
Anonymous
The file argüman must be of type string
Anonymous
Anonymous
Received type undefined
/warn learn to ask questions
Atropos
The file argüman must be of type string
paste your code or try local groups
Joo
Read a sequence of words from input. Use Quit as a word that terminates the input. Print the words in the order they were entered.
Joo
Please can someone help me with this question?
Joo
#include <iostream> using namespace std; int main(){ int a; char s[a][10]; string sample = "Quit"; for(int i=0;i<a;i++){ cin»s[i]; if(s[i]==sample){ a=i; } } for(int b=0;b<a;b++){ cout«s[b]«" "; } cout«endl; return 0; }
Joo
Im a beginner
Anonymous
I dont know how to use them
follow a different book/tutorial. any good modern C++ tutorial will introduce you to the containers instead of having you write shit code. see pinned message.
Joo
Ooh ok