Zel
use endl instead of \n everywhere except binary data
Is not a requirement and if writing lots of short lines can slow down performance
Asuna 🍓
Hey, I just started learning c++ and my professor gave me an assignment. I want the user to enter any character. Then I have to check weather it's Upper case alphabet or lower. Kindly help me.
Upper case: >= 'A' && <= 'Z' Lower case: >= 'a' && <= 'z' Next time use google first
Alex
how?
hmm, I am wrong sorry, this is for printf
Alex
premature optimization is evil
V01D
Okay, thanks
Zel
premature optimization is evil
Depends on usage is not premature if you need your code to run at a certain speed that you can preform debugging inside your permitted timeframe.
Vlad
premature optimization is evil
Sometimes it's not, for the graphics and such
Zel
Optimization is rarely a bad idea when it comes to graphics. GFX and audio both optimize early and optimize often
Alex
Usually premature using \n instead of endl for optimization is bad idea
Vlad
These demanding console apps are getting out of hand
Alex
if you have heavy output consider to not use cout at all
Rashu
Why they used printf If they have a chance to cout
Anonymous
Why they used printf If they have a chance to cout
Do you know the difference b/w %f & %.1f ? I wanted to know this.
Vlad
Why they used printf If they have a chance to cout
They wanted to output float with only digit after the point
Vlad
And were to lazy to do it with iostream
Zel
Why they used printf If they have a chance to cout
If you have large amounts of data out print f is preferable any way. But yeah loading down the console will impact performance.
Vlad
These demanding console apps are getting out of hand
Nils
Then which one??
Qt creator or kdevelop
Anonymous
/report
klimi
/report
you need to reply to a message to report it
Saurav
Qt creator or kdevelop
Are these paid or free??
Saurav
Visual Studio Code Emacs Far Manager with Colorer plugin
Thank you bro 😌. BTW I'm using VS CODE now. Isn't is good?
Saurav
Define "good"
Good for C & C++ programming
Davi
Visual Studio Code Emacs Far Manager with Colorer plugin
Vim (omicomplete) + ctags + cscope/gtags A similar configuration may be replicated on Emacs
Davi
🙂 yep, matter of personal preferences.
A static analyzer is also good for speeding up development. Currently I am using cppcheck for non-embedded stuff, but clang has a famous one. GCC introduced -fanalyzer in version 10 if I am not mistaken.
Saurav
/get ide
Thanks bro 🙏
Renan
Text editor != IDE
Renan
Text editor is part of a IDE.
Konstantin
Text editor is part of a IDE.
Is there any reason you will be willing to have them separately? I.n software engineering world.
Renan
Text editor is part of a IDE.
As such, a IDE is not suitable for quick editing of text (e.g. a personal reminder). Yes, you can use it. But it is overkill (and a waste of resources, unless the IDE was already open).
Renan
As such, a IDE is not suitable for quick editing of text (e.g. a personal reminder). Yes, you can use it. But it is overkill (and a waste of resources, unless the IDE was already open).
And before using a IDE to do everything for you (compile, execute, organize, format code, etc.) is very important that you learn to do all these things by yourself, which is usually done with command line tools.
dj
how to read space seperated integers in c++🤔
Anonymous
By the can you guys recommend a CLI debugger
Renan
By the can you guys recommend a CLI debugger
We present the tools, it is up to you to judge what will best fit for your use case. Use wisdom.
Renan
how to read space seperated integers in c++🤔
I do not know about C++, but in C we use printf.
Renan
I do not know about C++, but in C we use printf.
I mean scanf or other function... 😅
dj
cin<< can be used in c++
dj
but how to read space seperated int like 39 25 59 to an array or something
dj
is vector similar to am array ?
Renan
is vector similar to am array ?
It is an array, as far as I know.
Noarch
Container
dj
i see to use loops and all and input numbers one by one
Noarch
What's more, vector has more function
Renan
Google?
No. Stack Overflow. Go straight to the source. 😅
Renan
No. Stack Overflow. Go straight to the source. 😅
Stack Overflow, the google of developers. 🤔
Noarch
Stl stuff
Suryanand
Dima
what the hell
Suryanand
I meant stack overflow is google and dark web combined :))
Noarch
How abt mfc , some friends said it's too old to learn
Davi
but how to read space seperated int like 39 25 59 to an array or something
I don't know the "C++ way" of doing it, but if you import the C stdio you can use scanf and check the return value to ensure the variable was initialised correctly. You may want to use scanf(" %d", ...); to ignore any amount of whitespace characters before the integer (tabs, spaces, newlines, carriage returns).
dj
yes but i dont know how many numbers will be there
dj
yes
dj
it depends on user how many numbers will be there
dj
i like to do it without asking user number of int in the line
dj
there must be an easier way :)
K
It's complicated
olli
yes but i dont know how many numbers will be there
if you want to read a bunch of consecutive integers you can use the operator bool() of std::istream - it will return false if there is an error or it's not ready for IO
Arthur
while(cin >> x){ }
Arthur
this should try to read integers while it's possible
Tatuck
Hello! I have a question, do you know how should I compile a cpp file???? I tried using Visual Studio Code, but I couldn't make it work, it says: fatal error: cpr/cpr.h: No such file or directory. So I tried using g++ with this command: g++ -g -Wall -I/include file.cpp -o file, but it also don't work either. AND the last thing I did is trying to use cl command using: cl /I\include file.cpp. And this also didn't work. Any help? Thanks!!