$@!
Best DSA in c++ tutorial
$@!
?
Dima
no
$@!
Rs is currency?
Indian currency
touhou
Rs is currency?
Yeah, short form for Indian rupees. But the actual symbol is ₹. Most of the times the symbol won't be present in default keyboard or hard to find. So they use "rs".
Daulet
Rs is currency?
Thanks for all. I understand
DaviChan
Yes
Thank you for the interest 😊. Should i start from 0 also, like most other playlists do or only cover topics that are hard to find otherwise
DaviChan
Or don't get covered properly?
DaviChan
Because there are some 😅
DaviChan
At least in the playlists I have seen so far
DaviChan
That is very true!
DaviChan
let's see. I will plan it out today and will record the first videos tomorrow :) Any topic wishes/suggestions already?
Daulet
let's see. I will plan it out today and will record the first videos tomorrow :) Any topic wishes/suggestions already?
Idk what popular in C++ for beginners. But maybe videos about templates & constexpr relevant in current time
DaviChan
concepts etc. modules and so on are also cool and not too well covered yet
DaviChan
lets see 😅🤔
Aze
Not sure if I am getting you here. You want a game of yours be released on Arc8 or what?
Ольга
https://onlinegdb.com/nWEjjT85v Good evening, please help me, I always want to understand this topic and it doesn't work out, and here's an error in the code again. I will be very grateful for any advice, help or explanation
Dima
Tlistitem does not contain “first” and “last” you need to find it through the list you probably need to use Tlist
а
clion
u r using the biggest peace of shit i've ever seen
DaviChan
Whats wrong about Clion?
《K•r•e•m•e•l》
Does anyone here use Kate editor? In linux?
Daulet
Does anyone here use Kate editor? In linux?
I know that editor, but I not used it
《K•r•e•m•e•l》
《K•r•e•m•e•l》
When I run gcc and try to compile a file in it says there is a warning for main.h header file but I have not problem in the file...
Daulet
Like clangd
DaviChan
Does anyone here use Kate editor? In linux?
Yes, but only for very small things
DaviChan
Its a very good text editor though
《K•r•e•m•e•l》
Like clangd
I have gcc..
《K•r•e•m•e•l》
Yes, but only for very small things
Its showing Chinese in any file that I open through it...that I have copied from one directory to another
Daulet
I have gcc..
ggc not have any autocomplete
DaviChan
ggc not have any autocomplete
no compiler has that I guess
DaviChan
at least not that I am aware
Daulet
no compiler has that I guess
I used micro editor. And I think micro just runs compiler for check code, but lsp server will be a lot faster than that
the best for everyone
u r using the biggest peace of shit i've ever seen
could you send me the entire code to see that because I have made as you told me but nothing changed
the best for everyone
the best for everyone
I did it like this
the best for everyone
and its not working
klimi
u r using the biggest peace of shit i've ever seen
Could say the same about your message, if you are going to claim such things append your reasoning to the message as well as you don't just create havoc. Thank you
Shahadat Shanto
https://hastebin.com/iqatuqucuw.cpp
Shahadat Shanto
https://hastebin.com/iqatuqucuw.cpp
this code Counts the number of nodes at given level in a tree using BFS. How to print those nodes? Please help
Anonymous
#Puzzle (Beginners) What will be the output of this program?
#Solution The correct answer is 111. Kriss and Captain got it right. The [] operator inserts an element if the key is not present. In the case of a class, the element is default constructed. So doing m[7] calls the default constructor of C (no matter if we assign to it right after), setting default_constructed to true. The expression C(1) constructs an instance of C using the constructor taking an int, setting constructed to true. The = in m[7] = C(1) calls the copy assignment operator to copy assign the newly created C(1) to the previously default constructed C inside the map, setting assigned to true. The fact that an object is first default constructed is covered by §[map.access]¶2 in the standard: T& operator[](key_type&& x); Effects: Equivalent to: return try_emplace(move(x)).first->second; where try_emplace is defined by §[map.modifiers]¶8: template <class... Args> pair<iterator, bool> try_emplace(key_type&& k, Args&&... args); Effects: If the map already contains an element whose key is equivalent to k, there is no effect. Otherwise inserts an object of type value_type constructed with piecewise_construct, forward_as_tuple(std::move(k)), forward_as_tuple(std::forward<Args>(args)...). value_type is just a typedef for pair<const Key, T>, which in our case is pair<const int, C>. So it inserts a pair(7, C()), which calls the default constructor for C. To avoid the default construction followed by a copy assignment, you can use one of the following: m.insert(pair<int, C>(7, C(1))); m.emplace(7, C(1));
Kriss
#Solution The correct answer is 111. Kriss and Captain got it right. The [] operator inserts an element if the key is not present. In the case of a class, the element is default constructed. So doing m[7] calls the default constructor of C (no matter if we assign to it right after), setting default_constructed to true. The expression C(1) constructs an instance of C using the constructor taking an int, setting constructed to true. The = in m[7] = C(1) calls the copy assignment operator to copy assign the newly created C(1) to the previously default constructed C inside the map, setting assigned to true. The fact that an object is first default constructed is covered by §[map.access]¶2 in the standard: T& operator[](key_type&& x); Effects: Equivalent to: return try_emplace(move(x)).first->second; where try_emplace is defined by §[map.modifiers]¶8: template <class... Args> pair<iterator, bool> try_emplace(key_type&& k, Args&&... args); Effects: If the map already contains an element whose key is equivalent to k, there is no effect. Otherwise inserts an object of type value_type constructed with piecewise_construct, forward_as_tuple(std::move(k)), forward_as_tuple(std::forward<Args>(args)...). value_type is just a typedef for pair<const Key, T>, which in our case is pair<const int, C>. So it inserts a pair(7, C()), which calls the default constructor for C. To avoid the default construction followed by a copy assignment, you can use one of the following: m.insert(pair<int, C>(7, C(1))); m.emplace(7, C(1));
😊👍🏻
Shahadat Shanto
If two consecutive character is same in a string array, how to remove both of them?
Raval
Hello
Vaghela
What is the while loop in c language please tell me with the example
Rajeev
this will fast our IO - cin.tie(0); But why we have to write this. Everyone wants that his code will executes fast. Then why C developer didn't make it permanent. Main question- what is happening inside cpu if we run our code with large input and output. Case 1 - cin.tie(0) Case 2 - cin.tie(1) I know it's silly questions but please solve my doubt.
Shahadat Shanto
What is the while loop in c language please tell me with the example
while loop is a conditional iterator as like for loop. In while loop, we run a loop until a certain condition is matched. eg. Say you have t = 2 test cases and you want to run the loop until t = 0, then your while loop would be: while(t--) { statement; }
\Device\NUL
std::cin.tie() by default tied with ostream, make sure ostream is flushed before reading from istream. More flush mean more write syscall so it would slower. ostream is by default fully buffered. It will be flushed when - find newline (default iostream synced with stdio, std::ios_base::sync_with_stdio(true)) - flushed manually by std:endl or std::flush - reading from input stream by default because std::cin.tie(&std::cout) With std::cin.tie(nullptr), you can manually decide when flushing ostream
\Device\NUL
What happen inside cpus is just bunch of assembly
Ludovic 'Archivist'
What happen inside cpus is just bunch of assembly
Partial truth (as CPUs are fairly complicated to say the least)
Ludovic 'Archivist'
this will fast our IO - cin.tie(0); But why we have to write this. Everyone wants that his code will executes fast. Then why C developer didn't make it permanent. Main question- what is happening inside cpu if we run our code with large input and output. Case 1 - cin.tie(0) Case 2 - cin.tie(1) I know it's silly questions but please solve my doubt.
A lot of things do happen whatever you run. Large IO generally means moving memory from one point to the other. A terminal (or tty) is generally an in memory device. What happens when doing large IO is that on syscall, the kernel will allocate some pages to the file descriptor of the tty and write your data to that. All of that, from the point of view of the CPU, involves virtual memory allocation, physical memory allocation, a lot of memory going up and down the different levels of cache, cache and branch prediction, and hundred more tiny parts working together for everything to go well
Ludovic 'Archivist'
(and I am not even going down to microcode level and pipeline level)
\Device\NUL
What happen inside cpus is just bunch of assembly
Maybe signicant of CPU instruction that invoke syscall which make IO slower
Captain
clion
Compiler?
Captain
Whats wrong about Clion?
It is pretty slow & heavy 😣
Anonymous
\Device\NUL
why not try it on online compiler
Daulet
37.00
DaviChan
It is pretty slow & heavy 😣
Ah okay, yeah there is sth. to that.
Anonymous
this will fast our IO - cin.tie(0); But why we have to write this. Everyone wants that his code will executes fast. Then why C developer didn't make it permanent. Main question- what is happening inside cpu if we run our code with large input and output. Case 1 - cin.tie(0) Case 2 - cin.tie(1) I know it's silly questions but please solve my doubt.
First of all cin.tie(1) should give you a compiler error. Perhaps you meant cin.tie(&cout). Anyway cin.tie(nullptr) will make your code slightly faster and a lot faster if you have lots of intermediary and regular outputs and quite a few inputs in between. But at what cost? The whole idea of tying an output stream to an input stream is to ensure that all output buffers get flushed before input begins. This is to ensure that any input prompts you may have like "Enter your name" et al get printed before your input begins. They serve as a useful guide to the user of your program. However if yours is. a program where users don't need prompts and they know what to input when, you can then certainly feel free to use cin.tie(nullptr) to ensure that no flushing happens unless the buffer is full or when you specifically ask for it. The reason why flushing an output buffer is slow is because the kernel has to write the contents of the buffer to another region (it could be a memory mapped region in which case it would be faster through a virtual driver or it may require a call to the underlying device driver of the device you are writing to which could be slow). That is why it's advisable to not use manipulators like endl frequently when you are writing something like a Logger service especially when the log level is INFO or DEBUG or TRACE. There is a disadvantage here as well. Incase your program crashes, then the contents of the output buffer are not flushed and you may end up losing some logs. So it takes careful jurisprudence on your part to determine when flushing is necessary.
Atamba
Hi guys.
Atamba
Has anyone tried facebook infer while developing in C/C++?
Atamba
If so, does it work? I'm developing on Linux(ParrotSec distro).
Atamba
... yet, I get a ton of errors for not recognizing iostream pre-processor header file.
Atamba
Which compiler ?
Tried g++, GNU gcc, all dump same error.
\Device\NUL
Tried g++, GNU gcc, all dump same error.
Install from package manager ?
\Device\NUL
Please clearly tell what you have done to reproduce the issue
Atamba
Install from package manager ?
I mean, the compilers are already installed, only when I try to check for ways to optimize my code using the infer static analyzer, I get the errors.
Atamba
Please clearly tell what you have done to reproduce the issue
Here is my CLI command to invoke infer. infer — g++ MoreGreedy.cpp -o mg
Atamba
Here is my CLI command to invoke infer. infer — g++ MoreGreedy.cpp -o mg
This is the dumped errors. Capturing in make/cc mode... MoreGreedy.cpp:2:10: fatal error: 'iostream' file not found #include <iostream> ^~~~~~~~~~ 1 error generated. Aborting translation of method 'main' in file 'MoreGreedy.cpp' Known incorrect assumption in the frontend: Expected source expression for OpaqueValueExpr Error: the following clang command did not run successfully: /opt/infer-linux64-v1.1.0/lib/infer/facebook-clang-plugins/clang/install/bin/clang-11 @/home/atamba/Documents/projects/steve/more_greedy/infer-out/tmp/clang_command_.tmp.60ce1e.txt ++Contents of '/home/atamba/Documents/projects/steve/more_greedy/infer-out/tmp/clang_command_.tmp.60ce1e.txt': "-cc1" "-load" "/opt/infer-linux64-v1.1.0/lib/infer/infer/bin/../../facebook-clang-plugins/libtooling/build/FacebookClangPlugin.dylib" "-add-plugin" "BiniouASTExporter" "-plugin-arg-BiniouASTExporter" "-" "-plugin-arg-BiniouASTExporter" "PREPEND_CURRENT_DIR=1" "-plugin-arg-BiniouASTExporter" "MAX_STRING_SIZE=65535" "-cc1" "-triple" "x86_64-unknown-linux-gnu" "-emit-obj" "-mrelax-all" "-disable-free" "-disable-llvm-verifier" "-discard-value-names" "-main-file-name" "MoreGreedy.cpp" "-mrelocation-model" "static" "-mframe-pointer=all" "-fmath-errno" "-fno-rounding-math" "-mconstructor-aliases" "-munwind-tables" "-target-cpu" "x86-64" "-fno-split-dwarf-inlining" "-debugger-tuning=gdb" "-resource-dir" "/opt/infer-linux64-v1.1.0/lib/infer/facebook-clang-plugins/clang/install/lib/clang/11.1.0" "-include" "/opt/infer-linux64-v1.1.0/lib/infer/infer/bin/../lib/clang_wrappers/global_defines.h" "-internal-isystem" "/usr/lib/gcc/x86_64-linux-gnu/11/../../../../include/c++" "-internal-isystem" "/usr/lib/gcc/x86_64-linux-gnu/11/../../../../include/c++/x86_64-linux-gnu" "-internal-isystem" "/usr/lib/gcc/x86_64-linux-gnu/11/../../../../include/c++/backward" "-internal-isystem" "/usr/local/include" "-internal-isystem" "/opt/infer-linux64-v1.1.0/lib/infer/facebook-clang-plugins/clang/install/lib/clang/11.1.0/include" "-internal-externc-isystem" "/usr/include/x86_64-linux-gnu" "-internal-externc-isystem" "/include" "-internal-externc-isystem" "/usr/include" "-Wno-ignored-optimization-argument" "-Wno-everything" "-fdeprecated-macro" "-fdebug-compilation-dir" "/home/atamba/Documents/projects/steve/more_greedy" "-ferror-limit" "19" "-fgnuc-version=4.2.1" "-fcxx-exceptions" "-fexceptions" "-o" "/tmp/MoreGreedy-ddbe77.o" "-x" "c++" "MoreGreedy.cpp" "-O0" "-include" "/opt/infer-linux64-v1.1.0/lib/infer/infer/bin/../lib/clang_wrappers/global_defines.h" "-Wno-everything"
Steven
This is the dumped errors. Capturing in make/cc mode... MoreGreedy.cpp:2:10: fatal error: 'iostream' file not found #include <iostream> ^~~~~~~~~~ 1 error generated. Aborting translation of method 'main' in file 'MoreGreedy.cpp' Known incorrect assumption in the frontend: Expected source expression for OpaqueValueExpr Error: the following clang command did not run successfully: /opt/infer-linux64-v1.1.0/lib/infer/facebook-clang-plugins/clang/install/bin/clang-11 @/home/atamba/Documents/projects/steve/more_greedy/infer-out/tmp/clang_command_.tmp.60ce1e.txt ++Contents of '/home/atamba/Documents/projects/steve/more_greedy/infer-out/tmp/clang_command_.tmp.60ce1e.txt': "-cc1" "-load" "/opt/infer-linux64-v1.1.0/lib/infer/infer/bin/../../facebook-clang-plugins/libtooling/build/FacebookClangPlugin.dylib" "-add-plugin" "BiniouASTExporter" "-plugin-arg-BiniouASTExporter" "-" "-plugin-arg-BiniouASTExporter" "PREPEND_CURRENT_DIR=1" "-plugin-arg-BiniouASTExporter" "MAX_STRING_SIZE=65535" "-cc1" "-triple" "x86_64-unknown-linux-gnu" "-emit-obj" "-mrelax-all" "-disable-free" "-disable-llvm-verifier" "-discard-value-names" "-main-file-name" "MoreGreedy.cpp" "-mrelocation-model" "static" "-mframe-pointer=all" "-fmath-errno" "-fno-rounding-math" "-mconstructor-aliases" "-munwind-tables" "-target-cpu" "x86-64" "-fno-split-dwarf-inlining" "-debugger-tuning=gdb" "-resource-dir" "/opt/infer-linux64-v1.1.0/lib/infer/facebook-clang-plugins/clang/install/lib/clang/11.1.0" "-include" "/opt/infer-linux64-v1.1.0/lib/infer/infer/bin/../lib/clang_wrappers/global_defines.h" "-internal-isystem" "/usr/lib/gcc/x86_64-linux-gnu/11/../../../../include/c++" "-internal-isystem" "/usr/lib/gcc/x86_64-linux-gnu/11/../../../../include/c++/x86_64-linux-gnu" "-internal-isystem" "/usr/lib/gcc/x86_64-linux-gnu/11/../../../../include/c++/backward" "-internal-isystem" "/usr/local/include" "-internal-isystem" "/opt/infer-linux64-v1.1.0/lib/infer/facebook-clang-plugins/clang/install/lib/clang/11.1.0/include" "-internal-externc-isystem" "/usr/include/x86_64-linux-gnu" "-internal-externc-isystem" "/include" "-internal-externc-isystem" "/usr/include" "-Wno-ignored-optimization-argument" "-Wno-everything" "-fdeprecated-macro" "-fdebug-compilation-dir" "/home/atamba/Documents/projects/steve/more_greedy" "-ferror-limit" "19" "-fgnuc-version=4.2.1" "-fcxx-exceptions" "-fexceptions" "-o" "/tmp/MoreGreedy-ddbe77.o" "-x" "c++" "MoreGreedy.cpp" "-O0" "-include" "/opt/infer-linux64-v1.1.0/lib/infer/infer/bin/../lib/clang_wrappers/global_defines.h" "-Wno-everything"
can you find "iostream" in any of those paths?