Anonymous
Hmm that could help me identifying
Foxner
Hmm that could help me identifying
Or do this. First figure out how large your number is by dividing it by 10 in a loop, just like you do now, but don't change the original number. Instead, keep track of what the maximum divisor N should be (in case of 352 it would be 100 or 10^2). Then simply make another loop, and integer-divide the original number by powers of 10 from N down to 1 (in case of 352: 100, 10 and 1 to get 3, 5, and 2 respectively).
Anonymous
Hmm
Anonymous
Anonymous
Now i can see how many ways a programme can be solved 😊
Anonymous
what compiler are you using ?
I'm running in android rn, but I don't think it's compiler dependent https://rextester.com/SQDG60224
Lionel
How would s1,s2,s3 will be char * , but s4 would be a char
Lionel
warning*
Artöm
But giving input 352
Do it in strings
Artöm
Without floats and stuff
桃桃乌龙
I wonder if people still use scanf these days
Artöm
They do
Artöm
Because iostreams suck
桃桃乌龙
But scanf is unsafe isn’t it?
Dadaskis
But scanf is unsafe isn’t it?
Why not, we die like real man
桃桃乌龙
Uh.. afaik visual studio won’t compile if you have those unsafe functions by default.
Anonymous
scanf could be but (not sure which of these are extensions or not) you can specify a buffer size for %s or even have it allocate a buffer for you that's the right size
Anonymous
yeah, there's a flag that you need to set to use unsafe crt functions
Anonymous
How would s1,s2,s3 will be char * , but s4 would be a char
When ever you use #define, the string macro will be replaced by the value after it. For example your code" #define string_d char* c, when the program is preprocessed where ever string_d is seen it will be replaced with char* before going to compilation.
桃桃乌龙
so why not just use read instead
桃桃乌龙
sscanf can do the same thing I thought
Anonymous
So in your code string_d s3,s4 is read like this, char* s3,s4; where s3 is a char pointer while s4 is simply char. Similar as int *ptr1, y, *ptr2; where pte1, ptr2 are pointers while y is an int.
Lionel
So in your code string_d s3,s4 is read like this, char* s3,s4; where s3 is a char pointer while s4 is simply char. Similar as int *ptr1, y, *ptr2; where pte1, ptr2 are pointers while y is an int.
I see. Since it's not an actual redefinition like typedef, it just replaces the specified identifier. Fine. It is treated as char *_variablename_, rather than char*
Foxner
Now i can see how many ways a programme can be solved 😊
I've played about and wrote a simple code myself. I encourage you to try and write it yourself, but if you're interested, here's a working solution: https://repl.it/repls/NumbMinorSlash
Anonymous
#define just replace the string macro name with its macro value. In this case, wherever string_d is seen it will replace it with char*. While typedef will create new datatype from existing one. For example typedef string_t char *; will create a new datatype string_t which is char*. If you write code string_t x,y,z; all these should be of type char* or char pointers.
Lionel
Fine. Understood. Thank you
桃桃乌龙
This reminds me of #define ever (;;) for ever{
Anonymous
I'm not recommending the use of scanf or anything, I'm just saying not all use of it is unsafe
Anonymous
Implicit cast maybe
Yeah, probably
Lionel
What are the exceptions and we all know that it's not a coincidence that left shifting is equivalent to multiplication by 2
Lionel
Is equivalent for unsigned integral types, but not for the rest
Right. because shifting can't be performed on float and double types
Francisco
Right. because shifting can't be performed on float and double types
I don't know if you can, but I'm sure it won't do what one could expect it to
Anonymous
Okay
Mr_X
Mr_X
Anyone tell me the logic
I_Interface
/report think by yourself
RISHIKESH
Rules
Dima
/warn Read the rules
Anonymous
Kali linux lol Another HaCkEr
Dima
Kali linux lol Another HaCkEr
Lol! Just noticed these tabs
Dima
Anonymous
Is there any way to get the last element of a priority_queue without traversing the entire queue?
Anonymous
will *q.rbegin() work?
Anonymous
was everything just purged again
Dima
Yes, keep your nods and cries in #ot
数学の恋人
Lol! Just noticed these tabs
LOL! those are bookmarks
Anonymous
Hii rose
Vishal
😂😂☝️
Vishal
People are talking to bots
Anonymous
I am new
Vishal
No problem dude
Vishal
That happened to me as well
Francisco
Is there any way to get the last element of a priority_queue without traversing the entire queue?
By definition, you can't traverse a queue without poping the elements
Anonymous
will *q.rbegin() work?
Look to the docs
Anonymous
😂
Lionel
Why is that the use of fflush(stdin) is not a good practise and causes undefined behavior? And the manual is saying it's used for output buffers especially. Is there any alternatives to fflush() for clearing the buffer. Particularly, when we have to read one character by character from the string constant, without reading the priorly updated characters.
Talula
Kali linux lol Another HaCkEr
Hacker who doesn’t even understand logic.
klimi
@roxifas
Roxifλsz 🇱🇹
Roxifλsz 🇱🇹
Whachu want
klimi
Yeet
Ceo
klimi
Check his profile
klimi
Suspicious
Roxifλsz 🇱🇹
UwU owo you better not fuckin advertise in my group umu
Talula
Suspicious
nah… people write funny things in their profiles.
Aira
Aira
This is 1d array program
Aira
Is there any problem or any mistake