nitin1 15 Master Poster

It is quite simple if you know the maths behind this.

All these are just bases in which you can write your any number. For example, n = 9 can be written as 1001 in base 2(binary) and it is 9 in base 10(decimal).

How am I writing 9 as 1001 in base 2?

Start with 9 and divide it it with 2. Take Quotient and remainder. Here, Quotient = 4 and remainder = 1. Now, Save this remainder anywhere. Now take quotient = 4 and again divide it by 2. Again, Quotient is 2 and remainder =0. Add this remainder where you have stored initial remainder. Repeat this until you get remainder 1 or 0. Note: Save the last remainder also. Still, you didn't get the answer.

Your answer is: If you read all the remainders from the last remainder to first remainder, that's your answer.

Here is code snippet for binary.

Void convertTOBinary(int n)
{
       while(n>0)
       {
             //save this remainder
             int remainder = n%2;
             n/=2;
       }
}

So, How to do for Hexadecimal. Can you relate now? When base was2, I was diving by 2, but in your case base is 16. So you will divide by 16 here as per the case. Difference is that in base 2, you can have only 2 remainders, but in Hexa, you can have 16 remainders. Remainders between 0-9 will be as it is, but after 9 it will be like this:

10 = A
11 = B …
nitin1 15 Master Poster

I play paino. I once played in one party which was quite sucessful. But that was not me alone, it was a team work.

Currently, I am focussing on my high notes voice skills. ;)

nitin1 15 Master Poster

what will happen if i download conio.h and explicitly add that file in the section where all other files are there ?

nitin1 15 Master Poster

can i ask one question ? that which thing does not support header files ? Like when u say "conio.h is not supported", so compiler doesn't support ? How can it be ? We insturct compiler to inlclude these-these header files while converting code into machine language. Can you elaborate ? @A.D sir OR James sir. thanks.

nitin1 15 Master Poster

you have to show some effort first. We will help you for sure if you will show us something which you have tried. Do some research and try to explore things and ask any doubt if you face any problem. hope it helps! thanks.

nitin1 15 Master Poster

declare your template outside the main() function and then try to compile it. hope it helps.! thanks.

nitin1 15 Master Poster

No body can help in your home work. You can put your doubts here , We all will help you. You should show something first, then we can solve if there is any doubt related to that. put some efforts into this, and if you find any problem, we will definitely help you. thanks.

nitin1 15 Master Poster
size_t fread ( void * ptr, size_t size, size_t count, FILE * stream );

I will suggest you to use sizeof operator for second parameter in the fread function. although, it will work correctly for some cases, but it will be problematic if integer is of 4 bytes on any other machine. try to change that, may be it will work. hope it helps! thanks.

nitin1 15 Master Poster

I am Indian and I have degree of a very highly reputated college in India. I hope you have heard of IIT's which are damn famous all over the world. I am not from there , but still am from a college which ranked 8th in all over India in terms of placements, campus, teaching , infrastructure etc. yes! i agree there is alot of cheating in various universities, but all companies here know the status of those universites and students from there hardly get any job in India atleast. Trust me, engineers from these top colleges are really really really great and there is no match with them as compared to those who cheat with degree.

Good engineers are increasing on per day basis in India but these fake degrees are making out of them. pity! because of this , students who are working hard suffer because of those cheaters. There is nothing to stop them and they will never be stopped. but even after all these things, India still have very high qualitative engineers and they share a big percentage in the ratio of engineers from all over the world. thanks.

nitin1 15 Master Poster

who is using different account and why ? :-o thanks

nitin1 15 Master Poster

@rahul, i know. never try to propose like this(directly). Indians girls have attitude problem with them, no matter they deserve that or not :p. So, try to go on dates, movies, restraunts, pubs etc. If she is comfortable with you at these places without any problem, then it is GREEN signal for you. If she says "no! akele ? kabhi nahi!", but if she says this in normal way, that means GREEN signal. Tell her stories about relationship of your mutual friends. Like this , in the moon light , sit on your knees and say her "will you be my partner ?". aww!! (looking damn easy, but trust me! Indians girls are damn tuff). This is my long term experience. :)

<M/> commented: lol +0
nitin1 15 Master Poster

hmm. may be. but sir, now i am just improving myself as a human, as a coder, as a user on daniweb and everything. my aim is now to improve myself as much as i can. no matter how many failures i will get, success willl be there for me at some point of time. :)

nitin1 15 Master Poster

it's a humble request that can i know the reason for 2 negative votes of my previous post in this thread ? so that i can improve in this thing also. thanks if u may do that.

nitin1 15 Master Poster

bro, don't worry! i know how you are feeling. you are in same boat like me. i also do topcoder, codeforces, codechef and all. i know what your problem is. i had also thought like you initially, but in one year i started thinking in terms of algorithms. even i implement algorihms in daily life. trust me, just give time to it. in metro, in train, in airplane , while walking, try to think about some problem of SPOJ etc. start thinking, take one problem and try to do it in 1 day or 2 or 3 or 4. you will not believe me but in the beginiing, i once took 11 days to solve one problem which was so easy if i look at it now. i am also going thorugh my internship and placement session , and those stupid companies take those who will give fast algos. :p take one problem, think on it for hours , hours and days. belive me when u will do that problem, you will say "woopieee!!" then you will enter in a cycle. DO PROBLEMS--> INCREASE CONFIDENCE--> DO MORE PROBLEMS--> INCREASE MORE CONFIDENCE... so this will never end. just try my method once and after some time, you will be ere who will say "yes! now i can solve and can see paterns" :) trust me, this is my practical experience and i have gone thorugh same wording which you have written above. thanks.

nitin1 15 Master Poster

it is a number in octal form as it has 0 in the starting. So it is 000 000 000 000 001 001, so this is nine as you well know ;) thanks

nitin1 15 Master Poster

see, I want you to do the work. here goes the hint! Take the head insertion as the special case and do it the main() only. okay ? now, then make a function and pass the info part which you want to store in the node. okay ? now, then with each node update the pointer where you need to insert the node, like after head, update a temp pointer with temp==temp->next where temp is equal to the head initially. okay ? So do it n number of times. :-) got it ?

P.S this is one way linked list explaination. for double linked list, nothing difficiult! just have one more pointer which will point to the previous nothing else. but i wana advice you that first try one way linked list, then update it to double linked list. it will be better for you. thanks

nitin1 15 Master Poster

firsly read Click Here. after reading this, Click Here, then if there is any doubt left, feel free to ask here only. thanks. ;)

nitin1 15 Master Poster

If the definition in the same file as the extern declaration is the only definition then the extern declaration will refer to it. I didnt get this line. will you please re-write it in different form ?

nitin1 15 Master Poster

ya! i know there is no difficulty in this concept! i am thinking as if i am fool :p but still i wana ask again.

when i have used extern int i; now it will refer i which is outside or extern to the file . right ? then in the next line, i am writing int i=10; then again there is another i for the compiler. So now which i will be used ? thanks.

nitin1 15 Master Poster

so @deceptikon when i am writing extern int i; and then using x in my program . So according to you, it it will not work because it is not defined ? But my question is that why will it not work as x is defined else where so it will present in trslation unit after linking from different file.

secondly, isn't this an error as i am saying to compiler that x is defined else where and again i am defining another x, so isn't it a re defintion of x error ? i don't know why am i confused so much in this thing as i know much about these already. thanks

nitin1 15 Master Poster

@deceptikon when i use extern int i; and it is also present in other file, then after that i can use it normally ? right ? like x=10 or int x=10 ? i think after declaring i just need to use x=10 only as i have already specified that it is int and extern. am i right ?

secondly, we say that declaration don't allocate memory, that means when i am writing extern int x then it will refer that variable present in the other file automatically ?

thirdly ,
will it be wrong to write

extern int x;

int x=10;

in the same file ?