...
i know but you have to use simple syntaxs
Your university professor is an idiot
MHD
Your university professor is an idiot
im in high school actually
...
Even worse
MHD
Even worse
you mean this question is wrong ?
...
you mean this question is wrong ?
The problem isn't trivial enough to be solved by highschool students. Sure you can come up with a solution that works well enough for small numbers. But the problem with floating point is inaccuracy as the number gets bigger. If you're planning on dividing and using mod to figure out the digits in reverse, that may not give you accurate results on sufficiently large numbers.
klimi
i know its hard to solve but i have to solve it
it's quite easy actually, just convert it to int so you don't get more inaccuracy and then reverse it
klimi
That doesn't work, you cannot represent all floats as ints
it's precision is 6 digits, i think you are fine with using int :)
klimi
What? Where are you getting that idea from?
https://en.wikipedia.org/wiki/Single-precision_floating-point_format
klimi
even if you could do this native reverse you wouldn't get enough precision beyond 6 digits so I don't think there is anything lost
...
So it's still incorrect.
klimi
??
????
...
Your "solution" is incorrect and faces the exact issue I was talking about, why are you bringing it up in the first place?
klimi
Your "solution" is incorrect and faces the exact issue I was talking about, why are you bringing it up in the first place?
You mean the issue that the question problem is so hard for highschool students that it cannot be solved? You said to use strings which is just overkill like you have been told. I think casting float to int would be considered basic features as opposed to sprintf
...
You mean the issue that the question problem is so hard for highschool students that it cannot be solved? You said to use strings which is just overkill like you have been told. I think casting float to int would be considered basic features as opposed to sprintf
If you want to implement it correctly, you're stuck with extracting all digits from a floating point number, sprintf does exactly that. Doing this is not a trivial task. As I said before, implementing a solution that works sometimes is easy, but it will give you wrong results and no real way of doing error handling. I don't believe that this Problem should be asked in highschool because it's not to be solved by someone who doesn't understand the ins and outs of floating point
Pavel
Hi! I am trying to compile add libsnark in my project and have an error. I've set std=c++11 to libsnark project and original project has 20 std /usr/local/include/libsnark/knowledge_commitment/knowledge_commitment.hpp:40:33: error: expected unqualified-id before ‘)’ token\ 40 | knowledge_commitment<T1,T2>() = default; | ^ compilation terminated due to -Wfatal-errors.
Mr
why?
klimi
why?
send it as audio recording instead
Pavel
send code screenshot
It's not allowed in this chat
Danya🔥
And of course it's broken There is no CI, no tests
Danya🔥
And it's been abandoned for 3 years
Danya🔥
send it as audio recording instead
I prefer these circle video messages. They are so fun!
Peter
hello, I have a problem here, In my learning , there is a task to write a simple shell in C. I am using getline to get user input, but theres an issue with EOF (Ctrl+D) in the regular shell, it seems that when I input EOF it is ignored, but in mine when I input EOF, I can no longer delete/edit behind the point where I pressed Ctrl+D at. how do I handle this EOF?
Anonymous
hello, I have a problem here, In my learning , there is a task to write a simple shell in C. I am using getline to get user input, but theres an issue with EOF (Ctrl+D) in the regular shell, it seems that when I input EOF it is ignored, but in mine when I input EOF, I can no longer delete/edit behind the point where I pressed Ctrl+D at. how do I handle this EOF?
There are many shells and each shell behaves differently. So the term regular shell could mean different things for different people. For ex I use fish and others may use bash or csh. So you can implement a specific feature the way you want it and describe the behavior of your shell to your teacher.
Peter
Just pick terminal which works for you and show it to the teacher...
It's an online course. I wanna learn the stuff instead of just copying it from somewhere
Satomi Ryuria
Shell is an application that connects users and the Linux kernel, allowing users to use the Linux kernel more efficiently, safely, and at low cost. This is the essence of Shell.
Satomi Ryuria
Shell itself is not part of the kernel, it is just an application program written on the basis of the kernel
Satomi Ryuria
https://fishshell.com/
Peter
Shell itself is not part of the kernel, it is just an application program written on the basis of the kernel
yeah, I meant that I am using bash, and that I want to replicate its behavior when Ctrl+D is pressed on my simple shell
Satomi Ryuria
If you want your own Bash to be so different, you can also customize the shortcut keys yourself, just use the bind command. The shortcut keys in Bash are actually provided by Readline. Therefore, the setting of the shortcut keys here is actually to configure Readline. There are two shortcut keys in Readline, one is the function shortcut key inside Readline, and the other is to execute the Shell command, the settings are slightly different
Ziky
yeah, I meant that I am using bash, and that I want to replicate its behavior when Ctrl+D is pressed on my simple shell
Maybe try to put your input into file and feed it to your program like this cat < my_input_file If you just learning i would stop wasting time on this
Anonymous
I meant shell. I want to be able to press ctr-D and have it not affect my input
You will then have to use the OS read and write calls instead of using C std library. And you also have to program your terminal emulator or the pseudo terminal to interpret Ctrl+D in a different way. I don't think a project for a student just learning about shells would be this involved. Check with your teacher on what he/she expects
Anonymous
So which one is for beginners and veterans?
There is no such thing. People use shells that they are comfortable with. By default this is bash but if you explore other shells you may find something that you like more. To each his own
Yash
https://doc.qt.io/qt-6/qtdesigner-manual.html maybe this
thank you btw if you have some exp. in Qt could we chat abt a error in pms? if you know and free i don't want to disturb cuz im learning for fun
Tokin
What would be the shortest introduction to C++ for someone coming from a C background?
Pavel
It skips a lot of legacy stuff and C stuff that you already know and goes through the most important features of the language, and the most recent stuff too
01001000001001100101
Guys, what your thoughts and opinions about learning DSA? Should I try to learn this concept using my knowledge of C ( it's basic, so in the journey I improve my c background) or just learn this concepts using any tool, because the application in the end is the same anywhere?
Pavel
991 pages.. Oh no
you can skip some stuff, like concurrency if you don't care about it right now, but well.. C++ is big
Tokin
Ah my bad it's just 312
Xerox53
Guys
Chat Boss
Omar Faruk sent a huge message, it has been re-uploaded as a file print the output of this code #include<bits/stdc++.h> using namespace std; int main() { int ..
Xerox53
Why does this yield A AA AAA Instead of, A BB CCC
Xerox53
Please help seomone
Xerox53
Someone
Alexander
Why does this yield A AA AAA Instead of, A BB CCC
Because variable ch defined inside second while loop body, move to one level higher, where j is defined
Xerox53
Because variable ch defined inside second while loop body, move to one level higher, where j is defined
Now I've done what you've said,the output is(for n=3) : A AB ABC
Alexander
Now I've done what you've said,the output is(for n=3) : A AB ABC
Ahh, didn’t get your initial intention, when move ch even more higher, before first while loop and increment it after second while loop
Peter
Hi, where can I practice nested loops using c++. I search for pdf.
Lxjxjxhks
hey is there a way to initialize vector at one place and then declare later the space it requires, ideal way to do it is : vector<int> v(10,0);
Lxjxjxhks
i want to do `vector<int> v; v(10,0);`
Think Like A Computer Scientist !
A Tour of C++ 3rd edition from Stroustrup, I would say
It's too bad, I want to read this book too, but unfortunately my English is not very good, there is no translation in my native language
Pranjal
Can you pls forward back my message lol And I was only getting that issue in c++
Pranjal
char ab = "a"
Pranjal