Davi
Ammar
fflush(stdin) is UB in C
Ditto that. Yes, fflush(stdin) is UB. If it's implementation defined at all, it won't be portable.
Ref: https://stackoverflow.com/questions/2979209/using-fflushstdin
Anonymous
Thanks
Anonymous
If anyone could suggest me some C++ project ideas using classes n objects, it would be sweet.
Nomid Íkorni-Sciurus
Hello
Nomid Íkorni-Sciurus
Window() = default;
Window(const Window&) = delete;
virtual ~Window() = default;
virtual void init(HINSTANCE hInst, HWND parent)
{
_hInst = hInst;
_hParent = parent;
}
Nomid Íkorni-Sciurus
I was looking at this piece of code in the source of Notepad++ (Window.h)
and I was wondering... why to declare the constructor default and then to declare a init() ?
\Device\NUL
👁👄👁
Ammar
Maybe something goes wrong with your code.
Ammar
OK
Talula
Anonymous
Define a class named BUBBLE consisting of following members:
i) ROLL: of type unsigned short integer under private visibility label
ii) NAME: a character array of size 30 under private visibility label
iii) PERCENT: of type float under private visibility label
iv) getdata(): a public member function which accepts all data members.
v) putdata(): a public member function which displays all data members.
vi) check(): a public member function which accepts an object of type BUBBLE
and returns 1 and 0 depending on comparison of data member NAME
of the two objects.
Write main function which accepts an array of object from the user and performs
BUBBLE SORT on basis of data member NAME, to obtain the array in
alphabetical order.
Anonymous
Can anyone help me with that ^
Abhi
Talula
Nomid Íkorni-Sciurus
Nomid Íkorni-Sciurus
that would be weird though, because super constructors would be called anyways
instead he declared it "virtual"
so I'm guessing they're considering to customize the initializer
which is the part I fail to understand
Nomid Íkorni-Sciurus
why not to use the constructor?
Talula
why not to use the constructor?
Well frankly speaking I programmed Windows in C++ back when I was in school, that is like 16 years ago... but I remember using init() as it had to be used, but I never question it.
Phoenix
Hey guys i m a beginner here so bare with me if i ask some silly questions
Phoenix
My question is
Does main function always have to be declared with int data type?
Nomid Íkorni-Sciurus
\Device\NUL
Talula
Nomid Íkorni-Sciurus
Nomid Íkorni-Sciurus
you could make it void if your compiler allows it
Nomid Íkorni-Sciurus
but honestly it's better to make main return an error code.
Nomid Íkorni-Sciurus
Anonymous
I wanna ask u like can we assign an operator to a variable?
\Device\NUL
I got warned when using void main
Phoenix
Yeah that's the point i watched some c++ lectures that were old and they went using void main
But today my compiler is giving an error so i just had a query why.
\Device\NUL
The value returned by main function is the value returned to the OS, cmiiw
\Device\NUL
You can see returned program value with echo $? in *nix, cmiiw
Anonymous
Phoenix
Phoenix
IDE
Phoenix
So is this group good for asking doubts if any ?
I m a beginner though
Anonymous
Talula
Anonymous
Hello, Anyone have C4droid??
Phoenix
I have Cxxdroid apk through which you can code in your mobile phone.
Anonymous
hi
Veykhan
Veykhan
Anshul
Anonymous
folks, what does 'n' mean in "strncpy()"?
Anonymous
n in strncpy()?
Anonymous
Anonymous
string copy
it's just a short form ig
Anonymous
Roy
Hey guys, quick question.
What is the function to exit the whole C++ program?
Like if someone entered a certain value, it leads for the program to end. What is that function that does that?
Anshul
It's Strcpy
Anshul
I never heard strncpy
Anshul
Roy
How?
Anshul
Just use throw;
Anshul
It'll call terminate as no catch block written
Daniela
Hi, can anybody help me ?
Anonymous
Anshul
Anonymous
https://en.cppreference.com/w/cpp/string/byte/strcpy
CALVIN
And what's strcpy
It's a string function for copying string characters....
I guess you confuse these with strcmp
Anshul
strcpy( ) function copies whole content of one string into another string. Whereas, strncpy( ) function copies portion of contents of one string into another string.
Anshul
Found this*
Anonymous
{ЅᎯⅅⅅ-ℰ}
Hello everyone, I'm struggling with arduino 🤭 you can also output this with While loop:
1
22
333
4444
55555....
\Device\NUL
Ssssss
hello guys...i m stuck at this error error: redefinition of 'BankDeposit::BankDeposit()'
22 | BankDeposit::BankDeposit()
Ssssss
redefinition of class error.
{ЅᎯⅅⅅ-ℰ}
So what's the problem ?
But this one with a while loop.
I can't do that.🙈
Is it even possible to do that with a While Loop?👇
{ЅᎯⅅⅅ-ℰ}
void setup()
{
Serial.begin(9600);
}
void loop()
{
for ( int i = 9; i > 0; i--)
{
for ( int a = 0; a < i; a++)
{
Serial.print(i);
delay(200);
}
Serial.println(" ");
}
for ( int b = 2; b < 9; b++)
{
for ( int c = 0; c < b; c++)
{
Serial.print(b);
delay(200);
}
Serial.println(" ");
}
}