Welcome

Hi! This blog is for beginners of c++ and java .You can check and pick codes for your programming assignments. This will also help you to understand the concepts of these programming languages. Its all about programming.

C++ j0ke

Sunday, August 14, 2011

#include<iostream>
#include<conio.h>
#include<Windows.h>
using namespace std;

int main()
{
    system("title You are hacked! . . :-P");
    system("color 1a");               /* type system("color 1aa") to check COLORS. "1aa" isn't necessery to check colors.*/
    cout<<"LoL!"<<endl<<endl;
    system("color 2b");
    system("color 3c");
    system("color 4d");
    system("color 5e");
    cout<<"You are HACKED!";
    cout<<"\nAll your folders in your file system are being mailed to dj.qaxim@gmail.com"<<endl;
    cout<<"Hahahahaha. . .  g0t ya! Thankz n GUD Luk :D"<<endl<<"\nViruses launched . . . . . . . . . . .  . . . "<<endl;
    Sleep(7000);
    for(int i=0;i<16;i++)
    {
        system("start cmd");
        Beep(5000,100);
    }
    for(int j=0;j<16;j++)
    {
        system("start calc");
        Beep(5000,100);
    }
    for(int k=0;k<16;k++)
    {
        system("start mspaint");
        Beep(5000,100);
    }
   
    cout<<"JK . . ;-)"<<endl;
    _getch();
    return 0;
}

Lab Assignment (Q no 5 >> Ch#9)

Thursday, August 11, 2011

#include<iostream>
#include<conio.h>
#include<string>
using namespace std;

class employee
{
private:
    char name[10];
    int id;
public:
    void input()
    {
        cout<<"Enter your name:"<<endl;
        cin>>name;
        cout<<"Enter your ID:"<<endl;
        cin>>id;
    }

    void output()
    {
        cout<<"Name: "<<name<<endl;
        cout<<"ID: "<<id<<endl;
    }
};

class employee2:public employee
{
public:
    double compensation;
    int x;
    void input()
    {
        employee::input();
        cout<<"Enter compensation in $:"<<endl;
        cin>>compensation;
        cout<<"Enter \n1 if hourly.\n2 if weekly.\n3 if monthly"<<endl;
        cin>>x;
    }

    void op()
    {
        switch(x)
        {
        case 1:
            cout<<"\n\nPAID HOURLY"<<endl;
            break;
        case 2:
            cout<<"\n\nPAID WEEKLY"<<endl;
            break;
        case 3:
            cout<<"\n\nPAID MONTHLY"<<endl;
            break;
        default:
            cout<<"\n\nUnknown paid type."<<endl;
            break;
        }
    }

    void output()
    {
        employee::output();
        cout<<"Compensation: "<<compensation<<endl;
    }

};

class manager:public employee2
{
private:
    string title;
    int dues;
public:
    void input()
    {
        employee2::input();
        cout<<"Enter title:"<<endl;
        cin>>title;
        cout<<"Enter golf dues:"<<endl;
        cin>>dues;
    }

    void output()
    {
        employee2::output();
        cout<<"Title: "<<title<<endl;
        cout<<"Golf club dues: "<<dues<<endl;
    }

};

class scientist:public employee2
{
private:
    int pub;
public:
    void input()
    {
        employee2::input();
        cout<<"Enter number of publications:"<<endl;
        cin>>pub;
    }

    void output()
    {
        employee2::output();
        cout<<"No. of publications: "<<pub<<endl;
    }
};

void main()
{
    employee2 ob1;
    manager ob2;
    scientist ob3;
    cout<<"*****Employee Data Input******"<<endl;
    ob1.input();
    cout<<"******Manager Data Input******"<<endl;
    ob2.input();
    cout<<"******Scientist Data Input******"<<endl;
    ob3.input();
    system("cls");

    cout<<"/////////////////////////////////////////////"<<endl;

    cout<<"^^^^^^Employee^^^^^^"<<endl;
    ob1.op();
    ob1.output();
    cout<<"^^^^^^Manager^^^^^^"<<endl;
    ob2.op();
    ob2.output();
    cout<<"^^^^^^Scientist^^^^^^"<<endl;
    ob3.op();
    ob3.output();
    _getch();
}