Saturday, December 21, 2013

SCANF() - Some important features.

scanf()
The scanf()is very powerful function. We can use it to scan the input but we can add something in it's arguments and make it very powerful function.

Assume that we have one variable : a[100];

To read a string:
             scanf("%[^\n]\n", a);
            // it means read until you meet '\n', then trash that '\n'
 
 
To read till a coma:
             scanf("%[^,]", a);
            // this one doesn't trash the coma

             scanf("%[^,],",a);
           // this one trashes the coma
 
If you want to skip some input, use * sign after %. 
For example you want to read last name from "John Smith" :
          scanf("%s %s", temp, last_name);
         // typical answer, using 1 temporary variable

         scanf("%s", last_name);
         scanf("%s", last_name);
        // another answer, only use 1 variable, but calls scanf twice

          scanf("%*s %s", last);
        // best answer, because you don't need extra temporary variable nor 
           calling scanf twice 
 
 

To know, Why should u not use turbo c++ ? click here

 
C language
  

Saturday, December 14, 2013

Why should u not use turbo c++ ?

I have seen that in many under graduate collages turbo c++ is still used.  But now a days it is an outdated IDE.  Please, do not use it. It is totally useless.

Draw backs of Turbo C++
Turbo C++
There are many recent IDEs available which has great features and no bugs like GCC or Eclipse C/C++. Now a days GCC is treated as standard compiler.

some of drawbacks of Turbo C++:
  • Debugging is not as efficient as they are in other IDEs
  • It is not conformed with the standards that are laid down
  • It does not support modern casts, only C-Style casts.
  • I doubt if it may not goes well with 3rd party libraries! eg database or graphics libraries
There are other run time drawbacks also. So it is preferable to not use turbo C++ .




Friday, November 29, 2013

Why C treats array parameters as pointers?

In C we can see that array parameters are generally treated as pointers. See the following definitions of two functions:

void function1(int arr[])
{
  /* Silly but valid. Just changes the local pointer */
  arr = NULL;
}
void function2(int *arr)
{
  /* ditto */
  arr = NULL;
}
Array parameters are treated as pointers because of efficiency. Mostly when we pass array to the function then we mostly want to deal with same array. So no need to copy whole array to the function, just reference is sufficient. It is inefficient to copy same array as memory and time perspective .
C language

Wednesday, November 27, 2013

Voice Search On Google

 

 

Search by speaking.

- You can now say things like "pictures of …" or "where is …?"
- Fixed browser button in latest versions of Chrome.

Voice Search provides a method to search by speaking. For example,
just click on the microphone and say "kittens" to search for kittens. 
If you specifically want pictures of kittens, say "google images 
kittens". 
Want to learn more about World War II? Say "wikipedia world war two".

Voice Search comes pre-loaded with the following default services: 
Google, Wikipedia, YouTube, Bing, Yahoo, DuckDuckGo and Wolfram|Alpha. 

You can also add your own user-defined search engines. 
It also integrates speech input buttons for text fields on all websites.

This extension requires a microphone, and it needs access to all 
websites,
 so it can add speech input buttons to every text field.
 
 

How to Get it on your PC

>Download Google's Chrome browser.
>you need, because it turns out Voice Search is built right in. 
>Just head to Google.com, 
>then click the little microphone on the right side of 
>the search field. (Needless to say, this will work only if your PC has
 a microphone. 
Most laptops do; most desktops don't, unless you have a 
Webcam.)


The feature is also available in Google Maps,
 though it doesn't extend to other Google properties like Calendar, 
Gmail, and YouTube.
 

Sunday, November 17, 2013

HOW TO LOG OUT YOUR FACEBOOK ACCOUNT FROM OTHER COMPUTERS?

Facebook

We use to go cyber cafe or any other place and open facebook or from friend's mobile  and  sometimes we forgot to log out but now  don't need to be worry about it,there is a option to log out your account from every computer.....

follow the steps...

1. log in your account (from anywhere)
2. go to account setting
3. click on account security
4. and see there details...its shows
Last Accessed:
Location:
Device Type:
"see the image"
(if only these 3 things are shown there, then you are safe)
but

if there is an option to "end activity"that means your account is opened somewhere else also...
click "end activity" and you`ll be logged out from other computer

Sunday, November 10, 2013

Different Technologies & Their Founders

If any mistake, inform me ...plz...


1. Google: Larry Page & Sergey Brin
2. Facebook: Mark Zuckerberg
3. Yahoo: David Filo & Jerry Yang
4. Twitter: Jack Dorsey & Dick Costolo
5. Internet: Tim Berners Lee
6. Linkdin: Reid Hoffman, Allen Blue & Koonstantin
Guericke
7. Email: Shiva Ayyadurai
8. Gtalk: Richard Wah kan
9. Whats up: Laurel Kirtz
10. Hotmail: Sabeer Bhatia
11. Orkut: Buyukkokten
12. Wikipedia: Jimmy Wales
13. You tube: Steve Chen, Chad Hurley & Jawed Karim
14. Rediffmail: Ajit Balakrishnan
15. Nimbuzz: Martin Smink & EvertJaap Lugt
16. Myspace: Chris Dewolfe & TomAnderson
17. Ibibo: Ashish Kashyap
18. OLX: Alec Oxenford & Fabrice Grinda
19. Skype: Niklas Zennstrom,JanusFriis & Reid Hoffman
20. Opera: Jon Stephenson von Tetzchner & Geir lvarsoy
21. Mozilla Firefox: Dave Hyatt & Blake Ross
22. Blogger: Evan Willams

Thursday, November 7, 2013

DIFFERENCE BETWEEN CORE I3, CORE I5, CORE I7...??


-> Core i3:

* Entry level processor.
* 2-4 Cores
* 4 Threads
* Hyper-Threading ­ (efficient use of processor resources)
* 3-4 MB Cache
* 32 nm Silicon (less heat and energy)



-> Core i5:


* Mid range processor.
* 2-4 Cores
* 4 Threads
* Turbo Mode (turn off core if not used)
* Hyper-Threading ­ (efficient use of processor resources)
* 3-8 MB Cache
* 32-45 nm Silicon (less heat and energy)


-> Core i7:


* High end processor.
* 4 Cores
* 8 Threads
* Turbo Mode (turn off core if not used)
* Hyper-Threading ­ (efficient use of processor resources)
* 4-8 MB Cache
* 32-45 nm Silicon (less heat and energy)

Tuesday, November 5, 2013

C program to print a semicolon without using a semicolon anywhere in the code.

Generally when use printf("") statement we have to use semicolon at the end.
If we want to print a semicolon, we use the statement: printf(";" );
In above statement, we are using two semicolons . The task of printing a semicolon without using semicolon anywhere in the code can be accomplish ed by using the ascii value of';'which is equal to 59.
Program: Program to print a semicolon without using semicolon in the code.



#include
int main(void) {
//prints the character with ascii value 59, i.e., semicolon
if (printf("% c\n", 59)){
//prints semicolon
}
return 0;
}

Tuesday, October 29, 2013

C programs that print hello word without using semicolon

It is easy to run a program that prints hello world without using a semicolon. Here some solutions are given. try new if possible.
<Yahh..!! this is for B.Tech guys..!!>
......................................................

Solution: 1
 
#include
<stdio.h>
void main(){
    if(printf("Hello world")){
    }
}
Solution: 2
#include<stdio.h>
void main(){
    while(!printf("Hello world")){
    }
}
Solution: 3
#include<stdio.h>
void main(){
    switch(printf("Hello world")){
    }
}


Tuesday, September 24, 2013

How to find median in order of log n ?

Median in an infinite series of integers

Solution: Use 2 heaps: One MaxHeap and one MinHeap.

1) MaxHeap contains the smallest half of the received integers
2) MinHeap contains the largest half of the received integers

The integers in MaxHeap are always less than or equal to the integers in MinHeap. Also, the number of elements in MaxHeap is either equal to or 1 more than the number of elements in the MinHeap.

In the stream if we get 2n elements (at any point of time), MaxHeap and MinHeap will both contain equal number of elements (in this case, n elements in each heap).

Otherwise, if we have received 2n+1 elements, MaxHeap will contain n+1 and MinHeap n.

Let us find the Median: If we have 2n+1 elements (odd), the Median of received elements will be the largest element in the MaxHeap (nothing but the root of MaxHeap). Otherwise, the Median of received elements will be the average of largest element in the MaxHeap (nothing but the root of MaxHeap) and
minimum element in the MinHeap (nothing but the root of MinHeap). This can be calculated in O(1).

Inserting an element in heaps can be done O(logn). Note that, any heap containing n+1 elements might need one delete operation (and insertion to other heap) as well.

Total Time Complexity: O(logn).

Suppose we have sequence like : 1,9,2,0 then construction of heaps:

Insert 1: Insert to MaxHeap.

MaxHeap: {1}, MinHeap:{}

Insert 9: Insert to MinHeap. Since 9 is greater that 1 and MinHeap maintains the maximum elements.
MaxHeap: {1}, MinHeap:{9}


Insert 2: Insert MinHeap. Since 2 is less than all elements of MinHeap.
MaxHeap: {1,2}, MinHeap:{9}

Insert 0: Since MaxHeap already contains more than half; we have to delete the max element from MaxHeap and insert it to MinHeap. So, we have to remove 2 and insert into MinHeap. With that it becomes:
MaxHeap: {1}, MinHeap:{2,9}
Now, insert 0 to MaxHeap.


Via Narasimha Karumanchi Sir :