Wednesday, February 23, 2011

C++ Programs (Data Structures)

Best Blogger Tips

/*Q1.WAP to perform following operations on integer entered as Command Line
  Argument:
i)   To check if a number is prime or not
ii)  To print the sum and products of the number's digits
iii) To reverse the number
*/


#include <iostream.h>
#include <conio.h>
#include <math.h>


class operation     
{
int r,i,p,q,z;
public:
void prime(int);
void sum_and_pro(int);
void rev(int);
};


void operation::prime(int x)     
{

r=-1;
for(int i=2;i<=(x/2);i++)     
{
if(x%i==0)     
{
r=0;
break;
}
}
if(r<0)     
{
cout<<"\nThe entered number is a prime number.\n";
}
else
cout<<"\nThe entered number is not a prime.\n";
}


void operation::sum_and_pro(int x)     
{
z=0;
p=1;
q=x;
while(x!=0)     
{
y=x%10;
z+=y;
x/=10;
p*=y;
}
cout<<"\nSum of the entered number is "<<z<<"\n";
cout<<"\nProduct of the entered number is "<<p<<".\n";
}


void operation::rev(int q)     
{
cout<<"\nReverse of the entered number is ";
while(q!=0)     
{
y=q%10;
q=q/10;
cout<<y;
}
}


int main(int args,char *argv)    
{
clrscr();
int j,num;
char ch;
num=atoi(argv[1]);
operation op;
do     
{
cout<<"\n--------MENU--------\n"<<"\n"<<"1. Prime\n";
cout<<"2. Sum & Product\n"<<"3. Reverse\n";
cout<<"\nEnter your choice:";
cin>>j;
switch(j)     
{
case 1:
op.prime(num);
break;
case 2:
op.sum_and_pro(num);
break;
case 3:
op.rev(num);
cout<<".\n";
break;
default:
cout<<"\n\aInvalid Command\n";
break;
}
cout<<"\nDo you want to continue(y/n)?";
cin>>ch;
}while(ch=='y'||ch=='Y');
return 0;
}


/*----------OUTPUT-----------
--------MENU---------


1. Prime
2. Sum & Product
3. Reverse


Enter your choice:1


Enter a number:13


The entered number is a prime number.


Do you want to continue(y/n)?y


--------MENU---------


1. Prime
2. Sum & Product
3. Reverse


Enter your choice:2
Sum of the entered number is 4


Product of the entered number is 3.


Do you want to continue(y/n)?y


--------MENU---------


1. Prime
2. Sum & Product
3. Reverse


Enter your choice:3


Reverse of the entered number is 31.


Do you want to continue(y/n)?n
*/

Thursday, February 17, 2011

Useful Mathematics

Best Blogger Tips

Algebra

The Binomial Theorem

(1 + x)n = 1 + nx + [n(n-1) x2]/(2!) + [n(n-1)(n-2) x3]/(3!) + ...
If x << 1, then
(1 + x)n ≅ 1 + n x
(1 + x)-n ≅ 1 - n x
These approximations are useful when x2 is negliable.

Quadratic Equations

ax2 + bx + c = 0 has the solution,
x ={[-b ± (b2 - 4ac)]1/2} / (2a)

Trigonometry

π rad = 180 °
1 rad = 57.3 °
The quadrants in which trigonometrical functions are positive. Is shown below:
Figure 1. Signs of trigonometric functions.
A good way to remember this is the phrase clockwise ACTS. Clockwise gives the direction from the first quadrant is clockwise and each letter from the word ACTS stands for a trigonometric function: All, Cos, Tan and Sin. The direction of the angle increases in an anti-clockwise sense.
If A and B are angles then
tan A = sin A/cos A
sin2 A + cos2 A = 1
sec2A = 1 + tan2 A
cosec2 A = 1 + cot2 A


sin (A ± B) = sin A cos B ± cos A sin B

cos(A ± B) = cos A cos B -/+; sin A sin B

tan (A ± B) = (tan A ± tan B)/(1 &amp;mnplus; tan A tan B)

If t= tan (1/2) A, sin A = (2t) / (1 + t2), cos A = (1 - t2) / (1 + t2)


2 sin A cos B = sin (A + B) + sin (A - B)

2 cos A cos B = cos (A + B) + cos (A - B)

2 sin A sin B = cos (A - B) - cos (A + B)


sin A + sin B = 2 sin [(A + B)/2] cos [(A - B)/2]

sin A - sin B = 2 cos [(A + B)/2] sin [(A - B)/2]

cos A + cos B = 2 cos [(A + B)/2] cos [(A - B)/2]

 cos A - cos B = 2 sin [(A + B)/2] sin [(A - B)/2]

Power Series

ex = exp x = 1 + x + x2/(2!) + ... + xr/(r!) + ... for all x

ln (1 + x) = x - x2/ 2 + x3/3 - ... + (-1)r+1xr/r + ... (-1 &lt; x &amp;ltet; 1)

cos x = (eix + e-ix)/2 = 1 - x2/(2!) + x4/(4!) - ... + (-1)rx2r/(2r)! + ... for all x

sin x = (eix - e-ix)/(2i) = x - x3/(3!) + x5/(5!) - ... + (-1)rx2r+1/(2r + 1)! + ... for all x

cosh x = (ex + e-x)/2 = 1 + x2/(2!) + x4/(4!) + ... + x2r/(2r)! + ... for all x

sinh x = (ex - e-x)/2 = x + x3/(3!) + x5/(5!) + ... + x2r+1/(2r + 1)! + ... for all x

Apple Opening Biggest Store To Date In Grand Central Station

Best Blogger Tips
It has been confirmed by a close source to the Cult of Mac website that plans for Apple to build a new store in Grand Central Station are indeed true and the store will be Apples biggest and grandest to date.
According to the source the new store already has the name Grand Central and that Apple will be making an internal announcement within the next month or so. The new Apple store is expected to open in the Autumn sometime in early September.
Apple Store
The unamed source also said that the new Grand Station Apple Store  will be a grand affair saying: “The company will certainly pull out all the stops on this one,”
Apple retail outlets have helped grow the company and with this year being the 10th anniversary of Apple retail, you can expected something spectacular from Apple in Grand Central Station.

Wednesday, February 16, 2011

Some Cool Keyboard Tricks That Few People Know About

Best Blogger Tips

We have become so addicted to the mouse that we do not realize how much it disrupts our work as we keep reaching out for it. And just how annoying does it become when your mouse is unresponsive, gets stuck or you trip it over as you try to quickly get a hold of it.
The keyboard on the other hand is far more powerful than we realize. And don’t we have our hands all over it anyways? There are a few cool keyboard tricks that can help you save time and make you more productive.
Here is a short list for the most handy Windows XP and Firefox shortcuts. Some of these may also work in other applications.

Windows XP

1. [SHIFT] + [alt] + [PrntScrn] – high contrast
A window will open, click OK or simply hit [Enter]. This will enlarge the font on all open Windows and change colors to high contrast. For example the desktop will turn black, what was black text on white background will be reversed. Clicking the same key combination again reverts the changes.

2. [Ctrl] + [alt] + [up/down/left/right arrow] – rotate screen
This won’t work on every machine as it depends on your graphics card and video drivers. However, if it does work, it will rotate your desktop.
3. [Ctrl] + select items from taskbar, right-click selected – mass control open windows
cool keyboard tricksYou need to hold the [Ctrl] key while selecting open windows from the taskbar. To open the menu seen on the left, right-click any of the selected items.
With this trick you can simultaneously close a group of applications at once or show them side by side or stacked or in a cascade.
This can save a ton of time wasted on rearranging windows.
4. [Alt] + [Tab] – switch between running programs
A little window will launch showing all open programs. Click the [Tab] key to jump to the next application, release keys to open the selected one.
5. [SHIFT] + [Del] – bypass Recycle Bin
Selecting a file and pressing the combination above will invoke a delete confirmation dialog. Clicking ‘Yes’ will delete the file without sending it to the Recycle Bin.
6. [Windows] + [D] – show desktop or restore open windows
This is the keyboard shortcut to the respective quick launch taskbar icon.
7. [Windows] + [L] – lock system
An easy way to quickly protect and lock your system. When you log back in, all programs will still be running and windows will appear just the way you left them.
8. [Ctrl] + [Z] and [Ctrl] + [Y] – undo and redo
I’m sure you all know that you can undo changes using the [Ctrl] + [Z] shortcut. Wouldn’t it be awesome to have this feature outside the computer?  Anyways, you can undo an undo, i.e. redo what you did using the [Ctrl] + [Y] key combination.
9. [Windows] + [R], type cmd, hold [Ctrl] + [SHIFT] and hit Enter – run command prompt as Administrator
The command prompt will now be run as Administrator.
10. Create your own keyboard trick!
cool keyboard tricksAre there folders or applications you need a lot?  Why not create your own keyboard shortcut to quickly access these tools?
This will only work for shortcuts located on your desktop!
First you need to create an actual desktop shortcut. Right-click on the application and select > Create Shortcut from the context menu. Make sure the shortcut sits on your desktop. Now right-click the shortcut and select > Properties. You should see a line that says “Shortcut Key: <none>”. Click that line and then click a letter ony our keyboard, for example P. A shortcut will be created, in this example [Ctrl] + [alt] + [P]. And there you go, now you have your own personal shortcut key.

Firefox

1. [Ctrl] + [1] to [9] – jump to tab numbers 1 to 8 or last tab (9)
Rather than scrolling through all your open tabs, you can quickly navigate to a specific tab if you know its position. For example, clicking [Ctrl] + [4] will open to tab number 4 (from the left). With [Ctrl] + [9] you will jump to the very last tab, no matter how many you have open.
2. [Ctrl] + [Tab] or [Ctrl] + [SHIFT] + [Tab] – move up/right or down/left in tabs
Neat shortcut to move between tabs.
3. [/] or ['] – Find As You Type Text or Link
Firefox has a neat search feature, which is Find As You Type. When you click the [/] key before starting to type your search, Firefox will only search in text. Likewise, clicking the ['] key will only find links.
cool keyboard tricks
4. [Ctrl] + mouse wheel – change font size
With the new generation high resolution screens we often find that text on websites is way too small to read properly. Here is a little trick that can quickly increase the font size for better reading.
While you hold down the control key, move your mousewheel to increase or decrease the font size in Firefox. This will also work in other programs, for example Word.
This is also very useful for making a website fit your window size, rather than to adapt the browser window.
5. [Ctrl] + [F4] – close tab
A quick, mouseless way to close a tab.
6. [alt] + [F4] – close window
This will rapidly shut down Firefox.
7. [Ctrl] + [SHIFT] + [T] – open closed tab/s
Did you accidentally close that tab? Re-open it using this key combination.
8. [Spacebar] or [SHIFT] + [Spacebar] – scroll PageDown or PageUp
Give your mouse wheel a break and use the spacebar to move up and down a website.
9. [F7] – caret browsing
Caret browsing allows you to select and copy text from web pages using the keyboard.
keyboard tricks
10. [F11] – toggle full screen
Quickly change into full screen mode.

How To Enable & Troubleshoot Aero Effects In Windows 7 ?

Best Blogger Tips

Aero enhances Windows 7 with several visual effects. Aero Peek for example makes open windows transparent and reveals the desktop underneath them. These effects are very stylish and useful, but they are also heavy on your computer’s resources.
Depending on your system resources, Aero is not necessarily enabled per default. This article reveals how system components are scored and how you can enable or disable Aero effects.
Moreover, I will demonstrate how you can use only selected visual effects to go easy on your system resources.

What Aero Effects Are There?

  • Aero Peek

    This feature unites two similar effects. For one, it refers to the thumbnail preview you see as you hover over a taskbar icon. Once you move the mouse over the thumbnail, a full size preview of the respective windows is shown. Secondly, when you hover the mouse over the far right of your taskbar, all open windows become transparent and the underlying desktop is shown.
windows 7 aero
  • Aero Shake

    Click and shake a window to minimize all other open windows. To restore the minimized windows, shake the open window again.
  • Aero Snap

    Dragging a window to the left or right side of the screen will dock it to the respective half. This makes viewing two windows side by side very easy. Dragging a window to the top of the screen maximizes it. When you re-size a window and let it touch the top or bottom edge of the screen, it automatically maximizes vertically, while retaining its width.
  • Aero Flip

    This is a 3D effect that lets you flip through all open windows. It works with keyboard shortcuts only. Hold the [Windows] key and click the [TAB] key to launch the effect and then move between windows.
aero flip

Why Do Some Aero Effects Not Work On My Computer?

Windows 7 automatically adjusts Aero effects based on your computer’s Windows Experience Index. The index assesses key system components, including processor, memory, graphics, gaming graphics, and primary hard disk on a scale of 1.0 to 7.9. The base score equals the lowest subscore. The subscore for your computer’s graphics performance determines which Windows Aero effects are supported.

How Can I Find Out Or Update My Computer’s Windows Experience Index?

Go to > Start and type > experience index into the > search field. From the results click > Check the Windows Experience Index. If you have a laptop, make sure the power plug is connected as the test does not run on battery power. Then click > refresh.
windows effects

How Can I Adjust Aero Visual Effects?

Note that Aero is not available for Windows 7 Starter. Furthermore, you must use an Aero Theme, rather than a Basic or High Contrast Theme. To verify or change your theme go to > Startand type > theme into the search field. Then click > Change the theme and select a theme from the list of available > Aero Themes.
Make sure your Windows Experience Index (WEI) is up to date. When you just updated it, you can click > Adjust Visual Effects in the top left of the same window. Otherwise, go to > Start and type > adjust performance into the > search field. A window with > Performance Options for >Visual Effects will pop up.
This is where you can > Let Windows choose what’s best for my computer (based on your WEI score), > Adjust for best appearance, > Adjust for best performance, or select > Custom settings.
To go with the best performance and still retain functionality for all Aero effects, select only the following options:
  • Enable Aero Peek
  • Enable desktop composition
  • Use visual styles on windows and buttons
windows effects
For best performance you should have as little options checked as possible. I also like the >Show windows contents while dragging option, but other than that I can live without fancy visual effects.

What Can I Do If It’s Still Not Working?

Windows may have issues with your video driver or your system performance is too low to support Aero. Generally, the WEI subscore for your graphics must be 3.0 or higher for Aero to work. Note that my score is 2.7 and Aero still works rather well, however, Aero Peek was disabled by default. In any case, there is an easy to use troubleshooting tool that will track down the issue or fix bugs and automatically enable Windows Aero.
Again, make sure your WEI is updated. Then click > Start and type > Aero into the > search field. From the list click > Find and fix problems with transparency and other visual effects. In the wizard that pops up click > Next and the tool will work its magic.
windows effects
If the tool isn’t able to automatically fix some of the issues, you must attend to them personally. Then run the troubleshooting wizard again to automatically enable Aero, or go through the steps described under “How can I adjust Aero visual effects?” to do it manually.
Related Posts Plugin for WordPress, Blogger...
x

Get Our Latest Posts Via Email - It's Free

Enter your email address:

Delivered by FeedBurner