Anonymous
Thank you so much 🌹
Anonymous
You are great guys Thanks so much
V01D
How come?
V01D
Okay
Indolent
SPOILER ALERT Can't believe in this movie Jarhead the protagonist didn't fired a single shot till the fucking end
Parra
i been coding with c++ for 2 years I still do not know how to do some stuff in c++.
I've been coding 13 years C/C++ and I don't have fucking clue neither
Dima
even the language creator doesn’t know it at all
أسامة
one need projects to work on more than books to read
Parra
I haven't read a book in 8-10 years or so
أسامة
programming is about implementing not about bookworming
أسامة
BTW, i am reading now a program source🧐
Parra
the last book I read was this: https://www.amazon.com/Game-Engine-Architecture-Jason-Gregory/dp/1568814135
Konstantin
programming is about implementing not about bookworming
it depends on what you call "programming". if it is simple coding, then you could be right, but it is very boring life. if it is "software engineering", then "bookworming" is part of the job.
أسامة
even with software engineering you need something rather than books, nobody can make somebody learn engineering using a just a book case you need reading, but not from books. you need books only on the beginning
Parra
that depends on how you like to learn
Parra
I like to learn by example, doing projects and reading code of big open source projects
أسامة
i am studying source code of a game called "0ad", but not sure yet of its benfits
Parra
I am software engineer but the only thing I got from University is good contacts and learning the common jargon in order to communicate with other engineers
Parra
and now I'm writing a muti-runtime polyglot which is being used in a FaaS that I'm also developing
Parra
I haven't read a single book about how to build a FaaS
أسامة
I haven't read a single book about how to build a FaaS
that's the theory i am talking about, need time , patience , practise and study (but not using books)
Parra
experimentation is the best teacher
Parra
experimentation is the best teacher
this is my experience, it's ok if you read books, many people learns better in that way, but not me
Dima
Rashu
(std::cin) what is this meaning?
Rashu
std::cin
Rashu
What is this meaning?
Pavel
(std::cin) what is this meaning?
https://en.cppreference.com/w/cpp/io/cin
E
(std::cin) what is this meaning?
that is mean you can give a litral to the system
E
enter a litral
Sai
WAP to read the name of 10 student from keyboard and display them using string in c programming?
I_Interface
Roxifλsz 🇱🇹
So rude.
He's not wrong tho
I_Interface
He's not wrong tho
Hello, my good boy Roxi.
Roxifλsz 🇱🇹
Hello, my good boy Roxi.
Hello, Hatsune Miku fan
Anonymous
std::cout « "Hello" « std::endl;
V01D
Why does everybody use std::endl all the time? The console gets flushed twice, which makes std::endl useless in most cases
Anunay
std::cout « "Hello" « std::endl;
#noendl Have a look at these : https://m.youtube.com/watch?v=6WeEMlmrfOI https://m.youtube.com/watch?v=GMqQOEZYVJQ
Asuna 🍓
endl will flush console buffer afaik
V01D
why twice? endl adds newline char
std::cout flushes the console and std::endl flushes the console. Once is enough
V01D
Pretty sure I heard someone say it does.
Alex
could you provide a link?
V01D
Sadly no. It was some youtube video
Anonymous
I think it may depends on which complier you are using.
Asuna 🍓
Inserts a newline character into the output sequence os and flushes it as if by calling os.put(os.widen('\n')) followed by os.flush(). With \n instead of endl, the output would be the same, but may not appear in real time. ref from https://en.cppreference.com/w/cpp/io/manip/endl
V01D
g++
Asuna 🍓
So consider that you are debugging a crash bug with cout, without endl you may not get the exact last output.
olli
endl flushes, see [ostream.manip-2]. cout is only an object of type ostream [iostream.syn]. Looking at [ostream.formatted] there is no guarantee that it flushes for operator <<. [ostream.manip-2] http://eel.is/c++draft/input.output#ostream.manip-2 [iostream.syn] http://eel.is/c++draft/input.output#iostream.syn [ostream.formatted] http://eel.is/c++draft/ostream.formatted
V01D
So which is better in terms of efficiancy, and memory managment?
V01D
if you want to flush then endl is fine
Sure, but when would I wanna flush? Which is more efficiant?
V01D
Okay, but non debugging wise. What is the best way / fastest?
Asuna 🍓
ID for other languages is not allowed? The pinned msg doesn't seem to say that.
olli
Okay, but non debugging wise. What is the best way / fastest?
it depends what you want to do. If you don't need to flush then don't, flushing too often can reduce your performance. If in doubt run a benchmark and see the impact. I would hope cout is not on your hot path anyway.
olli
Sure, but when would I wanna flush? Which is more efficiant?
You probably want to flush if you have multiple programs communicating via stein/stout. Depending on your scenario you probably also want to flush your logger before your program terminates
Sai
Is it fine to write “void main()” or “main()” in C/C++?
Asuna 🍓
Is it fine to write “void main()” or “main()” in C/C++?
It works, but not recommended. Because the standard requires the main function to return an int value, and most OS will handle that value.
Zel
Also the value it returns can help with debugging.
Zel
There is no reason not to use endl any time you are done sending text to the console.
Zel
Now using it for every line ending can get expensive.
V01D
Now using it for every line ending can get expensive.
Got it. So from my understanding: I can have three cout calls, and only the last would really need an endl, like so: ... print(msg) { cout << "Msg is:\n"; cout << "DummyText...\n"; cout << msg << endl; //function end }
Muhammad Saad
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.