Tushar
/get cbook
Alviro Iskandar
about this, where do you think the 1st bit goes when you shift it to nothing? lol
it gets rid of the lsb, but that's not the exact answer, because it also shifts all bits to the right
Alviro Iskandar
simply unset the lsb with this 17 & ~1, that's the proper thing to do that
Alviro Iskandar
the fact that it gets rid of it is enough to prove my statement true
it is not 17 & ~1 is not the same with 17 >> 1
coal
because that unsets the bit
coal
it gets rid of it the same way a shift to nothing would
coal
with the difference that shifting also affects other bits
coal
i think we have different perceptions of the problem
coal
i think of binary as a stack of numbers that have an assigned value, which is a power of 2
coal
and the sum of all elements in this stack is the total value
coal
when i say "it gets rid of the right-most bit," i imagine getting rid of the lowest element of this stack and pushing the others down while also reassigning their values based on their new positions
coal
if we shift 1>>1, it ends up being nothing as we got rid of the last element of this stack
Alviro Iskandar
right, it affects all bits, if someone asks: how to get rid of the right-most bit of 17? if you answer 17 >> 1, it doesn't make any sense, because it shift all bits to the right by 1
coal
because their question is not about shifting but rather unsetting it without shifting
coal
the fact that shifting also gets rid of it, its a byproduct of the fact that it's shifted
coal
its like saying "i want a cake with strawberries" rather than "i want strawberries"
coal
the fact that both have strawberries doesnt mean they're the same thing
100$ website
....
Can anyone tell difference between when we use linked list with help of array and with help of pointer
....
Unable to understand it on web
Pavel
Can anyone tell difference between when we use linked list with help of array and with help of pointer
Not sure what you mean by "with help of array", can you provide an example or a link?
Nour
i need help please this is a procedur to display a list of books using linked list but its not working and i dont get whats her problem can someone check please this is it: void display (liste l) { liste currant; currant=l; while (currant!=NULL) { cout<< currant->ele.name << endl<<currant->ele.namew <<endl<<currant->ele.number<<endl; currant=currant->next; } }
100$ website
#include<iostream> using namespace std; int main() { int a=1; int b=2; if (a-- > 0 && ++b > 2) { cout<<"abdc"; } else { cout<<"xyz"; } { cout<<a<<" "<<b<<endl; } }
100$ website
why 0 3 after abcd?
Anonymous
why 0 3 after abcd?
Because of the cout at the end?
100$ website
Because of the cout at the end?
xd sorry being stupid most often
Harleen
Given an array of objects with two pointers, how can I iterate through it? Shape **xs = new Shape*[10]; I thought I can have a pointer and save the address of xs in it to access the objects in Shape array. Like: Shape *p = &xs. But it doesn’t seem to work.
Artur
Don’t use raw arrays
Artur
It’s c++ not c
Harleen
Thank you for the response. I am sorry but I don’t understand. :( and yes, it is cpp.
Prince Of Persia
auto p = &xs;
Simple solution for this case
Harleen
Ah, true!!!. I will try it with this and try to wrap my head around it as well. I Just googled what ‘auto’ does. 😊 Thank you so much.
Artur
Perhaps the best solution would to rewrite it to something like std::array, std::unique_ptr< Shape >, 10 > shapeArr; // or maybe shared depending on the scenario of usage
Artur
And then you could do something like for ( const auto& pShape : shapeArr ){ // do something }
Harleen
Thank you. 😊
klimi
start what?
klimi
I still don't understand what you want you want to "start it"
ㅤㅤㅤ
#include<bits/stdc++.h> using namespace std; int main() { int n,index=0,c=1; cin>>n; int a[n]; for(int i=0;i<n;i++){ cin>>a[i]; } int value = a[0]; while(index<n){ index +=value; c++; if(index= n-1){ break; } value = a[index]; } cout<<c<<endl; return 0; } What is problem in this logic Question - minimum number of jumps to reach end of array geeksforgeeks
Anonymous
I need help for infosys exam in online mode...guys will u help me
Anonymous
If anyone able to help me please tell other wise i will ask to anyone
klimi
I need help for infosys exam in online mode...guys will u help me
what do you mean? like you are preparing for the exam?
klimi
we won't help you cheat with that
klimi
You should feel ashamed even for thinking that you could cheat your ass to a job
klimi
NO, screw you. I despise people like you who pardon their own sins by saying "others commit crimes too"
Dima
lol thats why nowadays software is crap
klimi
and this is the reason
Anonymous
What purpose u r using this group
Tushar
for learning
Anonymous
Okay
klimi
What purpose u r using this group
did you seriously think that this group of 15k+ people is for helping people cheat their ass off?
Null
did you seriously think that this group of 15k+ people is for helping people cheat their ass off?
No ! I am not saying like this... 15 k + were helping a persons to learn coding
coal
#include <utilities> brings an error why?
oops, i meant <utility>, my bad
ROfficer
Ty :)
ROfficer
Also how do i store the float part of a float in an intenger? Like: 8.45 -> 45
ROfficer
I thinked to v -= floor(v); but i am kinda stuck
Md
#include<iostream> #include<conio.h> using namespace std; int main( ) { char nam[6]; nam[6]="Sakib"; cout<<nam; getch( ); }
Md
what is wrong here??
ROfficer
#include <cstring> i think
ROfficer
String is in some library
redfox
Why getch()
Artur
And there is also missing return
ROfficer
Oh ;-;
Artur
Using namespace std; is also a bad practise
Artur
Write std::string directly
Natalie
And there is also missing return
Doesn’t the compiler automatically add “return 0;” in the main function?
Artur
No
Artur
Right there there is an undefined behaviour, and sometimes in a bit larger projects it can lead to some nasty issues