Thursday 25 July 2013

Difference between classes and structures in c++.

Simple but many(or few) people misunderstood or are a not aware ability of structure in cpp to hold both member functions and data members.
                In C++, structure can have both variables and functions as members.It can also declare some of its members as 'private' so that they cannot be accessed directly by the external functions.Since class is a specially introduced data type in C++, most of programmers use the structures for holding only data, and classes to hold both the data and the functions.The only difference between a structure and a class is that structure members have public access by default and class members have private access by default, you can use the keywords class or struct to define equivalent classes.

Example:


struct employee
{
private:      //c++ structures can have access labels
int emp_no;
protected:
float salary;
public:
void getdata()   //c++ sturctures can hold both member functions and data members
{
cin>>emp_no>>salary;
}
void putdata()
{
cout<<emp_no<<salary;
}
}object1;
void main()
{
object1.getdata();
object1.putdata();
}

External Links:

http://en.wikibooks.org/wiki/C%2B%2B_Programming/Structures

http://en.wikipedia.org/wiki/C%2B%2B_classes 

Sunday 14 July 2013

How to configure VPN in Kali Linux?

From the creators of BackTrack comes Kali Linux, the most advanced and versatile penetration testing distribution ever created.As compared to backtrack5r3(bt5r3)  its successor Kali Linux   is more user friendly and more powerful & Without sound problems,software manger problem and many more(which were faced by BT5R3). Here we are discussing about configuring VPN(Virtual Private Network) in Kali.

For this we need to download and install some packages.

Using Terminal:

   Enter the following codes in your terminal.

  • apt-get install network-manager-openvpn-gnome          
             - Setting up network-manager-openvpn-gnome
  • apt-get install network-manager-pptp
             -Setting up network-manager-pptp
  •  apt-get install network-manager-pptp-gnome  
             -Setting up network-manager-pptp-gnome
  • apt-get install network-manager-strongswan
             -Setting up network-manager-strongswan
  • apt-get install network-manager-vpnc
             -Setting up network-manager-vpnc 
  •  apt-get install network-manager-vpnc-gnome
            -Setting up network-manager-vpnc-gnome
  • /etc/init.d/network-manager restart 

  Now essential packages are installed and VPN option is configured.

Thank You, Noah


Monday 3 June 2013

non graphical cricket game program code with c++

cricket game coded with c++:
  • user have choice to select team and opponent form three given teams - INDIAN team, AUSTRALIAN team, PAKISTAN team.
  • tossing available
  • 2 over game
  • 3 wickets
  • allows you to play game completely( ball- 2 overs, bat- 2 overs)
  •  based on numbers
coded by Noah Paul Jose .

#include<iostream.h>
#include<conio.h>
#include<stdio.h>
#include<ctype.h>
#include<stdlib.h>
int wkt=0,tm,op;
char *batsman;
void play(int);
void batsmann(int);
void bowler(int);
void main()
{
clrscr();
textbackground(WHITE);
textcolor(4);
clrscr();
int tos;
char toss;
cout<<"\n\n\n\n\n\n\n\n\n\n::::::==::==::==::==::==::==::::*****CRICKET*****::::==::==::==::==::==::==:::::\n ";
getch();
cout<<"\n                           noah @ my own creations";
getch();
cout<<" \n\n\n                         PLUS ONE - COMPUTER SCIENCE";
getch();
clrscr();
textbackground(YELLOW); 
textcolor(4);
clrscr();
cout<<"\n\n\n                        S=E=L=E=C=T   Y=O=U=R   T=E=A=M";
cout<<"\n\n\n\n                               ##:-FOR INDIA  1";
cout<<"\n\n\n\n\n                            ##:-FOR PAKSITAN  2";
cout<<"\n\n\n\n\n                           ##:-FOR AUSTRALIA  3";
cout<<"\n\n\n                         ENTER YOUR CHOICE::-  "; 
cin>>tm;
clrscr();
cout<<"\n\n\n                            ::::P=L=A=Y=E=R=S::::";
switch(tm)
  {
  case 1:
       {
       india: 
       cout<<" - Indian Team\n\n\n";
       cout<<"                         ##:- Sachin Tendulkar\n\n";
       cout<<"                         ##:- Yuvaraj Singh\n\n";    
       cout<<"                         ##:- Harbhajan Singh\n\n\n";
       break;
       }
  case 2:
        {
        cout<<" - Pakistan Team\n\n\n";
        cout<<"                        ##:- Taufeeq Umar\n\n";
        cout<<"                        ##:- Shahid Afridi\n\n";
        cout<<"                        ##:- Saeed Ajmal\n\n\n";
        break;
        }
  case 3:
        {
        cout<<" - Australian Team\n\n\n";
        cout<<"                        ##:- Michael Clarke\n\n";
        cout<<"                        ##:- Mitchell Johnson\n\n";
        cout<<"                        ##:- Nathan Lyon\n\n\n\n";
        break;
        }
 default:
        {
        tm=1;
        cout<<" - AUTO SELECTION(Team India)\n\n\n";
        cout<<"        YOU MADE AN INVALID CHOICE, SO YOUR TEAM IS AUTOMATICALLY SELECTED\n\n\n\n";
        goto india;
        }
  }
getch();
clrscr();
cout<<"\n\n\n                S=E=L=E=C=T   Y=O=U=R   O=P=P=O=N=E=N=T T=E=A=M                 ";
cout<<"\n\n\n\n                               ##:-FOR INDIA  1";
cout<<"\n\n\n\n\n                            ##:-FOR PAKSITAN  2";
cout<<"\n\n\n\n\n                           ##:-FOR AUSTRALIA  3";
cout<<"\n\n\n                         ENTER YOUR CHOICE::-  "; 
cin>>op;
clrscr();
cout<<"\n\n\n                            ::::P=L=A=Y=E=R=S::::";
switch(op)
  {
  case 1:
       {
       if(op!=tm)
       {
       cout<<" - Indian Team\n\n\n";
       cout<<"                         ##:- Sachin Tendulkar\n\n";
       cout<<"                         ##:- Yuvaraj Singh\n\n";    
       cout<<"                         ##:- Harbhajan Singh\n\n\n";
       break;
       }
       else
       {
       goto bottom;
       
       }
       }
  case 2:
        {
        if(op!=tm)
        {
        cout<<" - Pakistan Team\n\n\n";
        cout<<"                        ##:- Taufeeq Umar\n\n";
        cout<<"                        ##:- Shahid Afridi\n\n";
        cout<<"                        ##:- Saeed Ajmal\n\n\n";
        break;
        }
        else
        {
        goto bottom;
        
        }
        }
  case 3:
        {
        if(op!=tm)
        {
        cout<<" - Australian Team\n\n\n";
        cout<<"                        ##:- Michael Clarke\n\n";
        cout<<"                        ##:- Mitchell Johnson\n\n";
        cout<<"                        ##:- Nathan Lyon\n\n\n\n";
        break;
        }
        else
        {
        goto bottom;
        }
        }
  case 4:
        {
        english:
        {
        cout<<" - English Team\n\n\n";
        cout<<"                        ##:- Alastair Cook\n\n";
        cout<<"                        ##:- Ian Bell\n\n";
        cout<<"                        ##:- James Anderson\n\n\n\n";
        break;
        }
        }
 default:
        {
        bottom:
        {
        op=4;
        cout<<" -AUTO SELECTION\n\n\n";
        cout<<"        YOU MADE AN INVALID CHOICE, SO YOUR TEAM IS AUTOMATICALLY SELECTED\n\n\n\n";
        goto english;
        }
       }
     }
getch();
clrscr();
textbackground(WHITE);
clrscr();
cout<<" .............................YOUR GAME IS LOADING.............................";
cout<<"\n\n                       G::A::M::E    D::E::T::A::I::L::S";      
cout<<"\n\n      @ 12 Ball Game";
cout<<"\n\n      @ Each Team Have THREE Wickets";
cout<<"\n\n      @ Only Use Keys From 1 ,upto 6";
cout<<"\n\n      @ Using Of Any Other Key Is Considered As: \n";
cout<<"               While Batting: Loss Of 1 WICKET ";
cout<<"\n\n               While Bowling: Wide Ball";    
cout<<"\n\n\n\n\n                        TOSS(b= Batting,t= Bowling): ";
cin>>toss;
toss=tolower(toss);
if(toss=='b')
{
cout<<"\n\n                            You Choose To Bat First";
tos=1;
}
if(toss=='t')
{
cout<<"\n\n                            You Choose To Bowl First";
tos=2;
}
if(toss!='b' && toss!='t')
{
cout<<"\n\n            YOU MADE AN INVALID CHOICE, SO YOUR TOSS IS AUTOMATICALLY SELECTED";
cout<<"\n\n                               Auto Selected- Bat First";
tos=1;
}
play(tos);
 getch();
}

void play(int tes)
{
clrscr();
textbackground(YELLOW); 
textcolor(4);
clrscr();
int ovrbat,ovrbt,wkt=0,runs=0,i,b,runsop=0;
if(tes==1)
{
for(ovrbt=0;ovrbt<12 && wkt<3;ovrbt++)
{
                cout<<"\n\n\n\n       BALLS:: "<<ovrbt;
                cout<<"WICKET::-"<<wkt;
                
                
                cout<<"  BATSMAN: ";
                batsmann(wkt);
                
                cout<<"Enter Runs::- ";
                cin>>i;
                ovrbat=rand() % 6 + 1;
                cout<<"Bowler Shows::- "<<ovrbat;
                if(i!=ovrbat && i<7)
                {runs=runs+i;
                cout<<"Your Current Score::- "<<runs;}
                        else
{
                        cout<<batsman;
                        cout<<" Is Out";
wkt++;}
                }
        cout<<"Total Score::- "<<runs;
         
        cout<<"::INNINGS OVER:: ";
        cout<<"\n\n\n\n\nYOUR OPPONENT IS WAITING AHEAD FOR THE WAR";
        getch();
        clrscr();
for(ovrbt=0,wkt=0;ovrbt<12 && wkt<3 && runs>=runsop;ovrbt++)
{
                cout<<"\n\n\n\n       BALLS:: "<<ovrbt;
                cout<<"WICKET::-"<<wkt;
               
                
                 cout<<"  BATSMAN: ";
               bowler(wkt);
                cout<<"You Need To Ball::- ";
                cin>>i;
                ovrbat = rand() % 6 + 1;
cout<<"Batter Shows::- "<<ovrbat;
if(i!=ovrbat && i<7)
{runsop=runsop+ovrbat;
                cout<<"Opponents Current Score::- "<<runsop;}
                        else
{
if(i==ovrbat)
                        {cout<<batsman;
                        cout<<"Is Out";wkt++;}
                                else
                                {runsop=runsop+1;
cout<<"Opponents Current Score::- "<<runsop;ovrbt=ovrbt-1;}
                        }
}
        cout<<"::INNINGS OVER:: ";
  else
        {  
               for(ovrbt=0;ovrbt<12 && wkt<3;ovrbt++)
{
                cout<<"\n\n\n\n       BALLS:: "<<ovrbt;
                cout<<"WICKET::-"<<wkt;
               
                
                 cout<<"  BATSMAN: ";
                
                bowler(wkt);
                cout<<"You Need To Ball::- ";
                cin>>i;
                ovrbat = rand() % 6 + 1;
cout<<"Batter Shows::- "<<ovrbat;
if(i!=ovrbat && i<7)
{runsop=runsop+ovrbat;
                cout<<"Opponents Current Score::- "<<runsop;}
                        else
{
if(i==ovrbat)
                        {cout<<batsman;
                        cout<<"Is Out";wkt++;}
                                else
                                {runsop=runsop+1;
cout<<"Opponents Current Score::- "<<runsop;ovrbt=ovrbt-1;}
                        }
}
                
               cout<<"Opponent Scored::- "<<runsop;
                
               cout<<"::INNINGS OVER:: ";
               cout<<"\n\n\n\n\nGO AHEAD FOR THE WAR";
               getch();
               clrscr();
               for(ovrbt=0,wkt=0;ovrbt<12 && wkt<3 && runsop>=runs;ovrbt++)
{
                cout<<"\n\n\n\n       BALLS:: "<<ovrbt;
                cout<<"WICKET::-"<<wkt;
                
                
                cout<<"  BATSMAN: ";
                batsmann(wkt);
                
                cout<<"Enter Runs::- ";
                cin>>i;
                ovrbat=rand() % 6 + 1;
                cout<<"Bowler Shows::- "<<ovrbat;
                if(i!=ovrbat && i<7)
                {runs=runs+i;
                cout<<"Your Current Score::- "<<runs;}
                        else
{
                        cout<<batsman;
                        cout<<" Is Out";
wkt++;}
                }
       }




if(runs>runsop)
{
        cout<<"You Won";
        getch();
        clrscr();
        exit(0);
}
else
{
if(runsop>runs)
{
cout<<"You Lose";
                getch();
                clrscr();
                exit(0);
}
else
{
cout<<"DRAW game";
                getch();
                clrscr();
                exit(0);
}
}
return;
 }


void batsmann(int wkt)
{
if(tm==1)
{
if(wkt==0){
 cout<<"S.Tendulkar";
batsman= "Tendulkar";
 }
if(wkt==1){
 cout<<"Yuvaraj Singh";
batsman= "Yuvaraj";
}
if(wkt==2){
 cout<<"Harbhajan Singh";
batsman= "Bhaaji";
}
}
if(tm==2)
{
if(wkt==0){
 cout<<"Taufeeq Umar";
batsman= "TUmar";
}
if(wkt==1){
 cout<<"Shahid Afridi";
batsman= "Afridi";
}
if(wkt==2){
 cout<<"Saeed Ajmal";
batsman= "Ajmal";
}
}
if(tm==3)
{
if(wkt==0){
 cout<<"Michael Clarke";
batsman= "Clarke";
}
if(wkt==1){
 cout<<"Mitchell Johnson";
batsman= "Johnson";
}
if(wkt==2){
 cout<<"Nathan Lyon";
batsman= "Lyon";
}
}
return;
 }



void bowler(int wkt)
{


if(op==1)
{
if(wkt==0){
 cout<<"S.Tendulkar";
batsman= "Tendulkar";
 }
if(wkt==1){
 cout<<"Yuvaraj Singh";
batsman= "Yuvaraj";
}
if(wkt==2){
 cout<<"Harbhajan Singh";
batsman= "Bhaaji";
}
}
if(op==2)
{
if(wkt==0){
 cout<<"Taufeeq Umar";
batsman= "TUmar";
}
if(wkt==1){
 cout<<"Shahid Afridi";
batsman= "Afridi";
}
if(wkt==2){
 cout<<"Saeed Ajmal";
batsman= "Ajmal";
}
}
if(op==3)
{
if(wkt==0){
 cout<<"Michael Clarke";
batsman= "Clarke";
}
if(wkt==1){
 cout<<"Mitchell Johnson";
batsman= "Johnson";
}
if(wkt==2){
 cout<<"Nathan Lyon";
batsman= "Lyon";
}
}
if(op==4)
{
if(wkt==0){
 cout<<"Alastair Cook";
batsman= "Cook";
}
if(wkt==1){
 cout<<"Ian Bell";
batsman= "Bell";
}
if(wkt==2){
 cout<<"James Anderson";
batsman= "Anderson";
}
}
return;
}


compiled and tested with:
thank you - noah paul

Thursday 30 May 2013

download turbo c++ 4.5 compiler for windows..

turbo c++ 4.5 compiler with exception handling

DOWNLOAD YOUR FILE HERE


windows executive .rar file uploaded in datafilehost.com.

how to install your downloaded file:

  • unzip downloaded .rar 
  • open the extracted folder 
  • double click on install.exe 
  • follow instructions ,complete installation and enjoy your coding

first usage:

  • open installed directory (C:\TCWIN45 by default)
  • open folder named "bin"
  • double click on "TCW" (executive file) 
  • enjoying coding
thank you 

Saturday 4 May 2013

How to change DNS in Ubuntu?

DNS(Domain Name System)

Google public dns
  • open NETWORK option in system settings
     
  •  click options in the window that appears
                            
    • Select the IPv4 Settings or IPv6 Settings  
    •  select Automatic (DHCP) addresses only and enter DNS server add.
       in DNS server field
                       
      • For IPv4: 8.8.8.8 and/or 8.8.4.4.
      • For IPv6: 2001:4860:4860::8888 and/or 2001:4860:4860::8844
         

       save your current options and enjoy





       




       





Wednesday 24 April 2013

How to switch Ubuntu, from GUI to text mode?

transforming from GUI to text mode is really simple process:


                              Press ‘Ctrl + Alt + F1′ - GUI to text mode

                              Press 'Alt +F7'             -  back to GUI


Sunday 21 April 2013

Turn off guest session in Ubuntu 12.04

  • open terminal
  • enter following command  
            
                                     gksu gedit /etc/lightdm/lightdm.conf

     
  •  add    allow-guest=false to lightdm.conf file
  • then restart lightdm using command                                                                                                                     

                                      sudo restart lightdm

    Thank You