Wednesday 28 January 2015

Write a C++ program to show a function of a class showing concept of default arguments.


#include
using namespace std;
class value
{
public:
void show(char='h',int=5); //default arguments
};
void value::show(char y,int x)
{
int i;
for(i=1;i<=x;i++)
cout< cout<<"\n";
}
int main()
{
value a,b,c;
a.show();
//no arguments
b.show(87,2);
//one arguments
c.show('m',3);
//two arguments
}

Some facts about Static data members (in C++)


Static data members can be declared private and still can be accessed. Eg :
#include <iostream>
using namespace std;
class stat
{
private:
static int p;
public:
static int Get() { return p; }
};
int stat::p;
int main()
{
stat s;
cout << s.GetValue() << endl;
}

Static data members can be accessed in the same way by static member functions.

Tuesday 27 January 2015

Write a C++ program for a class which includes static variable.


#include < iostream>
using namespace std;
class stat
{static int count;
public:
int a;
void getdata()
{
cout<< "enter no";
cin>>a;
cout<< a;
count++;
}
void showdata()
{
cout<< "count is"<< count< <endl;
}};
int stat::count=0;
int main()
{int i;
stat a;
a.showdata();
for(i=0;i<4;i++)
{
a.getdata();
a.showdata();
}
}

An important detail to keep in mind when debugging or implementing a program using a static class member is that you cannot initialize the static class member inside of the class.

Sunday 25 January 2015

Write a c++ program to create the equivalent four-function calculator. The program should request the user to enter a number, an operator, and another number. It should then carry out the specified arithmetical operation: adding, multiplying, or dividing the two numbers. (It should use a switch statement to select the operation). Finally it should display the result. When it finishes the calculation, the program should ask if the user wants to do another calculation. The response can be ‘Y’ or ‘N’.


#include< iostream>
using namespace std;
class calc
{public:
void inp();
};
void calc::inp()
{ int a,b;
int o;
cout<< "1 for add,2 for subtract,3 for multiply, 4 for divide";
cin>>o;
if(o==1||o==2||o==3||o==4)
{
cout< < "enter 1st no";
cin>>a;
cout< < "enter 2nd no";
cin>>b;
switch(o)
{
case 1:
cout<< "addition is"< < a+b;
break;
case 2:
if(a>b){
cout< else
cout<< b<< "-"< < a<< "is"< < b-a;
break;
case 3:
cout<< "multiplication is"<< a*b;
break;
case 4:
cout<< a<< "/"<< b<< "is"< < a/b;
break;
}}
else
cout<<"your input is wrong, choose nos 1,2,,3,4";
}
int main()
{
calc c;
char ch;
do
{
c.inp();
cout<<"\nDo another (Y/N)? ";
cin>>ch;
}while ((ch=='y')||(ch=='Y'));
}

Friday 23 January 2015

A point on the 2-d can be represented by two numbers: an x co-ordinate and a y co- ordinate. For example (4,5) represents a point 4 units to the right of origin and 5 units up the origin. The sum of two points can be defined as a new point whose x co- ordinate is the sum of x co-ordinates of both points and same for y co-ordinates. Write a C++ program that uses a structure called point to model a point. Define three points, and have the user input values to two of them. Then set the third point equal to the sum of the other two and display the value of the new point.


#include<iostream>
using namespace std;
struct point
{
int x,y;
};
int main()
{ point p1,p2,p3;
cout<<"enter coordinates for p1";
cin>>p1.x>>p1.y;
cout<<"enter coordinates for p2";
cin>>p2.x>>p2.y;
p3.x=p1.x+p2.x;
p3.y=p1.y+p2.y;
cout<<"p3's x coordinate is " < cout<<"p3'y coordinate is " < return 0;
}

Write a C++ program for Raising a number n to a power p is same as multiplying n by itself p times. Write a function called power that takes a double value for n and an int value for p returns the result as double value. Use a default argument of 2 for p so that if this argument is omitted the number will be squared. Write the main function that gets the values from user the user to test the function.


#include <iostream>
using namespace std;
double power(double n,int p=2)
{
double x=1.0;
int i;
for (i=0;i x*=n;
return x;
}
int main()
{
double m,res;
int q;
char ch;
cout<<"Enter a number to be raised to a power: ";
cin>>m;
cout<<"Do you want to enter the power (Y/N): ";
cin>>ch;
if ((ch=='y')||(ch=='Y'))
{
cout<<"Enter the power to which the number "< cin>>q;
res=power(m,q);
}
else
res=power(m);
cout<<"The result is: "<<res;
}

Sunday 18 January 2015

So finally parents can control the cell phone uses by their child :P

So finally parents will be able to control the cell phone uses by their child. A new app for iOS devices has been developed. It lets parents to have control on the smartphone used by their kids. It is known as 'Ignore No More' app. The app cannot be disabled from the child device and the company claims that it is virtually impossible to be removed by the child. Parents just need to install the app on their phone as well as their child’s phone, tap their kid’s name and enter a four-digit code to lock their device. This means that if you find your kid spending way too much time on his/her smartphone, you could simply tell them that if they don't listen to you, you will lock their phones.

If your kid is away and you need his immediate attention, you could lock the phone until they call you back to get the password from you. It's important to note that the kid won't lose the ability to call for emergency services.

If a kid tries to deactivate the admin role for the app their phone will immediately lock and the parent will receive a warning via email. It is available for $5.99, the Ignore No More app lets multiple parents share the license via Apple Family Sharing.


Sunday 11 January 2015

Now whatsapp will be more interesting


Well all of you must be knowing about Android mobile messaging app WhatsApp which allows you to exchange messages without paying. Now android will include a new feature of voice calling in the application as soon as possible.
With the latest rumours even pulling the launch date even closer with some leaked images, this feature is set to increase the number of WhatsApp users by many times.
The Whatsapp update V.4.0.0 is not on the stores yet, it is under beta stage. It will be released to the stores officially. Anyway, the new Whatsapp update has the long awaited “Free Voice Calling” feature where you could make international FREE phone call!
There will be a new section for voice calls, separate from the application’s chat function. Nothing has changed on how to initiate a conversation with a friend, just like with chat messages; you can also open the app and find a contact you wish to call and with a single tap of a button, you’ll see the avatar of your contact and a call immediately initiate.
The new WhatsApp for voice calling will include a section where users can view their call logs grouped as received, dialled and missed. Pictures and shared messages will be visible from beneath each contact’s name.
Whatsapp has the highest used app in its messaging category, including Facebook’s Messenger.

Tuesday 6 January 2015

Do you want to avoid heart attack? See how!


Do you want to avoid heart attack? A 20-year study was conducted. It tracked the lifestyle habits of almost 70000 female nurses and found six behaviours that can reduce the risk of heart disease by 92%.
The US women least likely to have a heart attack engaged in two-and-a-half hours of moderate to vigorous exercise a week, did not smoke, watched television for seven hours or fewer a week and had a healthy weight, equal to a body mass index of between 18 and 25.
Happily, women who had small amounts of alcohol - about a drink a day - did better than those who did not drink. Too much alcohol was a risk factor for developing heart diseases.
Women who did not get heart attacks or develop diabetes ate a healthy diet similar to the "healthy eating pyramid" designed by Harvard University's school of public health nutrition programme.
The Harvard diet recommends eating very little red and processed meat, and having small amounts of sugar, sugary drinks and salt.
White bread, rice, pasta and potatoes should be eaten in limited quantities. The staple foods of the diet are vegetables, fruit and high-fibre whole grains such as brown rice and oats.
Cheese, low-fat dairy and poultry and fish are also recommended.
"Mortality rates from heart disease in the US have been in decline for the last four decades, but women aged 35 to 44 have not experienced the same reduction," said Andrea K Chomistek, the study's lead author and a researcher at Indiana University in the US.
After two decades of research, scientists concluded that three-quarters of heart attacks could be prevented if women lived healthily.
Over the 20 years, 456 of the 70000 women had heart attacks.
But 31691 were diagnosed with a risk factor for heart disease including diabetes, high blood pressure and high LDL cholesterol.
Women with risk factors could prevent heart attacks by following at least four of the six lifestyle factors, the study said.
The average age at which heart attacks occurred was 50.

Best Facebook and Whatsapp Statuses ever


One of daily tasks of today's generation is changing Whatsapp Status and updating on FB. But it takes a lot of time to think about status which matches our mood and I think we all are bored of regular statuses. So here I am providing a list of some new statuses :
Senti Statuses(in hindi) :


1) Tumne maangi dua hume mile har khushi jab tum hi meri khushi to fir kiun mile naa !
2) Tumne keh to dia yaad karna nahii khwaab me tum bhi aana nahi !
3) jaane mene tumhe koi dhokha dia ya jaane tumhe koi dhokha hua
4) dhundne ko zamaane se wafaa nikla, pta chala leke galat ptaa nikla
5) milega na tujh jeha koi or
6) ik aah to bhari hogii humne naa suni hogi tumne jaate-2 ik awaaz to di hogii
7) tu gal sunda v nae tu rukda vi nae, ve me kinjh tenu smjhavan
8) tu mere to judaa kacchh wargi hawaa childi sahaan nu
9) Tu thodi der hor ther jaa
10) tere jaan daa dard hah badaa
11) tune jo na kahaa me wo suntaa rahaa
12) haath choote to rishte nahi toota karte
13) tasveer dekhta hun roz me tumhari kiya tumko bhi kabhii yun mera khyaal aaya
14) maudat hui hah na yaar ka koi haal aaya
15) tere pyaar me tere bin asa bhi saal aaya
16) jitne bhi khat likhe the shikwe shikayton ke me aaj subh ko tere darwaze daal aaya
17) yaad kiya dil ne kahaan ho tum
18) jaagte-2 ik umar katii ho jasa

Happy Status :

1) tohfa hai tera ye meri adaa
2) ye bandhan hai pyaar ka dekho toote na saajna
3) ye haseen vadiyaan ye khula aasmaan
4) kitni khoobsurat hain aankhein tumhaari banaa dijiye inhe kismat hamaari !

Monday 5 January 2015

Now you can control the sent messages on the receiver's phone! isn't this interesting :D


The phone to whom we send the message downloads the Strings. And Strings can't stop the person on the receiving end from getting the text in the first place. The app is also only compatible with iOS.
Strings isn't the first app that aims to control smartphone screw-ups. Invisible Textlet enable senders to see whether or not the recipient has opened their text yet, and if they haven't, the sender can delete it. Ansa is the "Snapchat of texting," it means your texts self-destruct after a certain amount of time. And the application On Second Thought allows users to recall their texts 60 seconds after sending them and has a "curfew" feature, it means texts can be "embargoed" until the next morning in case you've had one too many.
But Strings CEO Edward Balassanian told The Huffington Post that Strings is the first messaging app that gives users total control over their content. "The challenge with ephemeral messaging apps is that they treat all content like it’s created equally, but we shouldn't have to delete everything in order to delete some things," he said. "Rather than trying to make content disappear, we sought to give users control so they would feel confident and comfortable to share what they want with who they want, in any way that they want."
"Friends can download content you share, but only if you approve," Balassanian continued. "Screenshots are detected and users are banned after violating this three times. And of course, you can delete a string you create if, and when, you choose to and it will be deleted everywhere. From start to finish, users control their conversations on Strings."
There are also apps out there that stop you from sending questionable texts in the first place. Designated Dialler blocks specified contacts in your phone

HTC announced HTC DESIRE 320


HTC has announced the entry-level Desire 320 this morning. It is a slightly higher-end Desire smartphone.
The HTC Desire 826 has a 13-megapixel camera on its rear and an Ultra Pixel shooter on its front, as well as HTC’s Eye Experience suite of camera goodies. HTC has also crammed Boom Sound speakers with Dolby Audio on the Desire 826’s front, along with a 5.5-inch 1920x1080 display. Buried inside of the Desire 826’s polycarbonate frame is a 64-bit octa-core Snapdragon 615 processor, 2GB of RAM, a 2600mAh battery and Android 5.0 running beneath HTC Sense.
HTC says that the Desire 826 is targeted at countries in the Asia-Pacific region. Whether or not it’ll ever see a release outside of that part of the globe remains to be seen, but with its combination of a polycarbonate body, 13-megapixel rear and Ultra Pixel front cameras, and a 5.5-inch display, I could see quite a few folks having jones for this new member of the HTC Desire family.


Sunday 4 January 2015

Now you can check if anyone is spying on you!


Technologists have invented new app called Snoop Snitch. It can detect International Mobile Subscriber Identity (IMSI) catchers by keeping a tab if someone is spying on you.
According to media reports IMSI catchers eavesdrop devices used for intercepting mobile phone traffic and tracking the movement of smartphone users.

Security experts recently revealed a massive security flaw that could let hackers listen in on private calls and read text messages on mobile networks.

One way in which such hackers get access to such information is by using IMSI catchers or 'stingrays'.

Snoop Snitch can detect IMSI catchers and warn smartphone users if their devices are giving up their personal information and connecting to them.

The app scans for signals that indicate a switch from a legitimate tower to a 'stingray', where information may be being collected.

The app currently works with Android handsets that have Qualcomm chips inside such as Sony and Samsung Galaxy models.

Friday 2 January 2015

Know about new feature of twitter

Twitter has introduced a new feature that will collect tweets in a Facebook-style news feed. Twitter has started a new recap feature to its mobile application called ‘While You Were Away’.

The “While you were away” feature pulls together posts that you might have missed. Like the Facebook news feed, the feature seems to choose tweets based on how much interaction they receive and whether an algorithm thinks users will be interested in them or not. Some users have got access to the feature in early December, but it has become popular in the recent weeks.


Hopefully it will be a bit more interesting with more fluency and features than simply pulling out the most popular posts, otherwise you could just end up seeing nothing but tweets from celebrities that got lots of Retweets, rather than stuff you care about.

Thursday 1 January 2015

OnePlus releases the Android 5.0 Lollipop alpha build for OnePlus One


In a submit launched on the OnePlus boards yesterday, it has launched the alpha build which can be downloaded manually as the replace won’t be obtainable over the air until OnePlus releases its secure build in February this year.
“That is the first step in what is going to turn into our personal customized ROM. It’s so early, actually, that this build accommodates no extras past the inventory options of AOSP Lollipop. It’s the base that we’ll proceed to build upon, enhance, and customise as we stabilize core functionalities on the newest firmware updates,” says the publisher.
OnePlus has added recognized points that it’s engaged on. As an example, knowledge roaming will probably be on default, digital camera and video could also be unstable, 4K video is supported in the alpha build however high quality is less than the mark, clock crashes periodically, Wi-Fi may be unstable, on first boot begin time is perhaps sluggish and so forth.
This build is ideally being launched because OnePlus is ready to determine points cropping up by way of suggestions from customers and work on them to provide you with a secure ROM.

The directions to flash your OnePlus One and set up the new ROM have been given step-by-step on the OnePlus forum.