Chat Boss
Sid Xid sent a code, it has been re-uploaded as a file
Olivia
✅check it as a switch case there are both armstrong and palidrome number
Olivia
okay
Notaxmar
Thank you all @Lory10e20 @Johnn_D0e. Thank you for your help. I have changed accordingly and it has worked
AC_
Guys does anyone know how to open FullScreen the graphics.h window in ubuntu 18.04? I tried with initwindow but it doesn't seem to be present in the library
MaaKa
Why cant it work in Cameroon ??😦
I can't tell Just says ChartGPT is not available in your country
Roxifλsz 🇱🇹
What's graphics.h?
Winbaby favorite header
klimi
Winbaby favorite header
no, he is on ubuntu; no windows
Roxifλsz 🇱🇹
Ubunut does not proove that he isn't a Wendy's user
klimi
Ubunut does not proove that he isn't a Wendy's user
but that means he is compiling for ubuntu 18.04 where is no such as window's graphics.h
Roxifλsz 🇱🇹
Yes.
Roxifλsz 🇱🇹
He wouldn't try to use graphics.h if he wasn't a Wendy's person
klimi
He wouldn't try to use graphics.h if he wasn't a Wendy's person
it's probably some other library not related to windows at all 😊
Egro
brain melting.. size() and capacity() member functions
Msec
brain melting.. size() and capacity() member functions
The size() and capacity() functions are two functions available in the C++ STL (Standard Template Library). The size() function returns the number of elements in a container. For example, if we consider that there are 5 elements in a vector, v.size() will return 5. The capacity() function returns how much memory is allocated for a container. This is memory reserved to be used for elements in the container. For example, if a vector has a size of 5 but a capacity of 10, the vector has 5 elements but allocates 10 elements in memory.
Egro
ohhh i see, capacity() double the space for the number of elements in a vector
Egro
thanks
Olivia
depends on the type of variable.
can u give me some example please
Olivia
sir?????????
Msec
can u give me some example please
for example int takes up 4 bytes double takes up 8 bytes, so it can hold larger numbers than a double int
Yash
Okkk
● Igor
FILE *file = fopen(argv[i], "r"); if (file == NULL) { fprintf(stderr, "%s: %s: %s\n", argv[0], argv[i], strerror(errno)); exit_status = errno; continue; } while (1) { int ch = getc(file); if (ch == EOF) break; putc(ch, stdout); }
● Igor
what is the proper way of handling errors during reading and writing to files here?
● Igor
should I check ferror inside the loop? or just after the while
Sara
int fp = open(outputPath,O_WRONLY|O_CREATE|O_TRUNC, S_IRUSR|S_IWUSR|I_IRGRP|S_IROTH);
Albina
I am trying to look for inconsistent data by comparing two files. If the temperature is off by 0.001 , I have to report it. However, while using the bsearch I am confused what my key has to look like
Sara
guys i have a segmentation fault for this line .. why ?
Chat Boss
Albina ✨ sent a code, it has been re-uploaded as a file
Albina
I'm unsure, but it feels like the problem is in the key
Ammar
guys i have a segmentation fault for this line .. why ?
I don't think that call is the cause of segmentation fault. Even if you pass an invalid address in that outputPath, the syscall will just return -EFAULT (not yields a SIGSEGV signal). That being said, it's somewhere else in your code that causes segfault. Please give more detailed information or send the related code.
Sara
outputPath.txt is a /output.txt where the folder "a/" doesn't exist in the cwd ... i think should be create with this code ... but i have this error of sf
● Igor
every single I/O operation to the file should be checked with ferror
so i believe i should disable buffer and manually buffer, because checking for each char seems very bad
\Device\NUL
so i believe i should disable buffer and manually buffer, because checking for each char seems very bad
Unbuffered is bad idea unless you wanna perform synchronized operation
\Device\NUL
system call is expensive tho, that's why it's fully buffered by default
Egro
pointers.. learning about it
Egro
a pointer is a memory addres of a variable double *p; declearing a pointer pointing to a variable of type double.
Egro
c++ abstraction: a pointer is an address, and an address is an integer..
布丁
A pointer carries more than merely an address
Egro
im just at the start of my "pointer" journey
布丁
For example, type information as you see in the pointer type
Egro
and what else ?
布丁
im just at the start of my "pointer" journey
I would suggest you you to treat it as an indirect way of accessing a variable. Don’t look at the underlying stuff atm
Egro
i see. i grasp it better with your explanation .
Egro
Thank you.
布丁
and what else ?
Pointer Provenance. It says that even the underlying addresses are the same, compilers may still treat two pointers differently.
布丁
This topic seems a bit advanced, but it emphasizes again that pointers are not equivalent to addresses.
Egro
your definition clear things up
布丁
I hope you don’t get confused 😂
Egro
a pointer is just a indirect way of accessing a variable... this is clear and i comprehend it
布丁
Later when you learn arrays, you’ll probably revisit the address thing again
Egro
i learned of arrays
布丁
Then pointer arithmetics?
Egro
i am at the beginning of my pointer journey. now i am on int *p1, *p2, v1,v2; v1 = 0; p1 = &v1; *p1 = 42; p2 = p1; p1 , p2 and v1 will be assigned 42.
布丁
Uh don’t worry
MaaKa
greetings everyone i have an incomplete code and please i need someone to help me end the IF (escape sequence ) of my code .. thank you
Chat Boss
MAKA sent a code, it has been re-uploaded as a file
Chat Boss
Ammar Faizi sent a huge message, it has been re-uploaded as a file This doesn't look right: if (temp == sum){ // do A } else if (temp != sum) { ..
Ammar
greetings everyone i have an incomplete code and please i need someone to help me end the IF (escape sequence ) of my code .. thank you
[ Trying to resend in chunks just to avoid stupid file conversion by the bot. ] This doesn't look right: if (temp == sum){ // do A } else if (temp != sum) { // do B } else { // do C } Because:
Ammar
[ Trying to resend in chunks just to avoid stupid file conversion by the bot. ] This doesn't look right: if (temp == sum){ // do A } else if (temp != sum) { // do B } else { // do C } Because:
Because: If temp == sum is true, then temp != sum is false. If temp == sum is false, then temp != sum is true. So you will always fall in the "if" or the "else if" block. The "else" block is unreachable. In other words, the "// do C" part is never executed.
MaaKa
I will try it now
Anonymous
The message I reply to is 798 chars long. I just sent 410 chars long, but it's detected as a "huge message" while 798 isn't. How do you actually measure a "huge message"?
If a significant part of your message is detected to be code, it reuploads it as a file. The bot doesn't interfere otherwise. I will ask Dima and Klimi to check with the person who developed the bot to see if some changes can be made so that 10 or so lines of code are allowed.
Anonymous
The message I reply to is 798 chars long. I just sent 410 chars long, but it's detected as a "huge message" while 798 isn't. How do you actually measure a "huge message"?
Barring you, no one else has complained about the bot. Maybe that is why the admins are not willing to change it. I will get back to you on this.
ahmet
What i whould learn after basics in c++
Arvin
solving some simple cases