Mihai
become a good developer is a matters of time and hard learning.
Mahdi
I mean, introducing a website.
Vlad
I mean, introducing a website.
You haven't passed the Turing test so you must be either bot or extraterrestrial intelligence
Anonymous
Help please compile this code Fix the problem #include<stdio.h> int main() { int n1,n2; char op; printf("Enter any two numbers:"); scanf("%d%d",&n1,&n2); printf("\n Enter any arithmetic operator:"); scanf("%c",&op); switch (op) { case '+' result=n1+n2; break; case '-' result=n1-n2; break; case '/' result=n1/n2; break; case '*' result=n1*n2; break; case '%' result=n1%n2; break; default : printf("invalid choice"); } printf("result=%d, return"); return 0; }
Anonymous
Difference between std::endl and \n please???
Anonymous
What
Anonymous
What
Differences between std::endl and “\n” please???
Ehsan
Differences between std::endl and “\n” please???
there’s no difference between std::endl and “\n” in most cases
Igor🇺🇦
Differences between std::endl and “\n” please???
std::endl = "\n" + flush.
Anonymous
Differences between std::endl and “\n” please???
I don't I'm something' mistake write this code you help please
Ehsan
there’s no difference between std::endl and “\n” in most cases
but in some cases you want to “flush” out the output buffer, so you use std::endl
⚛ Hz
std::endl is function(
⚛ Hz
So you can write std::endl(std::cout)
⚛ Hz
(or just endl(std::cout) (don't need using namespace
Ehsan
I never fully understood what flush really is
what didn’t you understand exactly?
Igor🇺🇦
Anonymous
(or just endl(std::cout) (don't need using namespace
Why using namespace is not a good habit??
mov $22, %rax
Write out all data in buffer.
but I mean, when I write to a file I don't need to do that
mov $22, %rax
why do I need it with stdout (which is a file, at least in Linux)
⚛ Hz
Why using namespace is not a good habit??
(because it may causing name collision with you custom function
⚛ Hz
Example: std::log is math function, but you may have a custom log function for logging, if you using namespace std, it will create confusing when use log
mov $22, %rax
but I mean, when I write to a file I don't need to do that
I mean, while writing my position in the file advances, so that I'm always at the END of the file, unless I seek some position So why should I fflush...
⚛ Hz
but I mean, when I write to a file I don't need to do that
No, you actually need it, but before file closed, all uncommitted buffer will be flushed (automated
Igor🇺🇦
why do I need it with stdout (which is a file, at least in Linux)
It has buffer. When you write to file, at some point you're going to close it. That's when buffer will be flushed. When it's stdio you're not closing it, so os doesn't know when to write everything out.
⚛ Hz
why do I need it with stdout (which is a file, at least in Linux)
Because in most cases the next line is to receive input from command line, right? It will block the program, so the internal buffer cannot be flushed automated
كحيل العين
Hi guys
كحيل العين
I'm learning c++
Alex
I'm learning c++
what are you learning except c++? please provide the whole list
كحيل العين
My learning In diagnosing the code
كحيل العين
My problem is in English 😒
كحيل العين
I will learn
Anonymous
Ashish
Can anyone tell me how should we start learning programmimg i.e. in which manner ?
B121065_Swoyam Siddharth Nayak
Can someone help me in creating a function that converts decimal to binary
B121065_Swoyam Siddharth Nayak
Like i made a function but that would print its binary form in reverse order
Pavel
Can anyone tell me how should we start learning programmimg i.e. in which manner ?
Read book or watch tutorials, repeat what you read or see, try to understand what you are doing. Then when feel comfortable start writing your own small projects
B121065_Swoyam Siddharth Nayak
void dectobin(int n){ while(n>0){ cout<<n%2<<" "; //1 0 1 1 1 1 n/=2; } }
Diego
void dectobin(int n){ while(n>0){ cout<<n%2<<" "; //1 0 1 1 1 1 n/=2; } }
There's an STD function for that Funny enough, I learned about it just today
Diego
Why does this have to be so awkward? https://www.geeksforgeeks.org/stdsetbase-stdsetw-stdsetfill-in-cpp/
B121065_Swoyam Siddharth Nayak
B121065_Swoyam Siddharth Nayak
So i don't need to rewrite std again and again
Diego
Why does this have to be so awkward? https://www.geeksforgeeks.org/stdsetbase-stdsetw-stdsetfill-in-cpp/
Basically std::setw and std::setfill are used for padding out strings, it uses the value from setfill to pad it up until it's the size set by setw And setbase is used to set the numeric base for a number value
Diego
Are you new to coding ?
Not particularly new I think
B121065_Swoyam Siddharth Nayak
Accha then you might be able to help.... Lens explain the issue in my function
B121065_Swoyam Siddharth Nayak
void dectobin(int n){ while(n>0){ cout<<n%2<<" "; //1 0 1 1 1 1 n/=2; } }
So if i put 47 The expected output is 101111 But i get 111101 That is complete reverse
Wojak
Yeah, my English is a little weak. sorry.
No need to be sorry brother It's fine English is just a language and not a skill and if you are good enough to convey your ideas which I reckon you already are, then that's enough. Just work a little on sentence formation and you are good to go. And don't let anyone tell you otherwise specially on Internet because "Dudes" try to be extravagant about things they know as little as a rice grain in hay. Keep learning and don't take negative opinions of random strangers across the globe on Internet. You can PM me if it's hard to explain and I will try to be as helpful as possible. Have a good day.
Pavel
So if i put 47 The expected output is 101111 But i get 111101 That is complete reverse
That's because you write the least significant bits first to the stream. What I can suggest as a fast solution, you can write it to an array and then write it in reverse.
Farah
Hello guys,so I have a question, I've been looking for loading bar code in C,cuz I need it in my project
Farah
Do you have any suggestions?
Igor🇺🇦
H
What IDE do you guys recommend me?
Beyond
visual studio or codeblocks
Anonymous
Clion is best if u hava a ssd
Prince Of Persia
Anonymous
Take gcc 10 for windows 10 from winlibs
Beyond
Or visual studio code
thats not an ide and its 'visual'
Prince Of Persia
Clion is best if u hava a ssd
Yeah But still good for HDD
Anonymous
Yes good enough
Anonymous
Also winlibs has gcc 10.2 for windows ready to go
Anonymous
For toolchain
Anonymous
I. E. Compiler
Anonymous
CLion
dude there isn't a country like Iran that everyone can cracks softwares. CLion isn't free (except 30-day free trial plan for students I guess).