Monday, 21 September 2015

General Tree in c/c++ Source Code, c++, source code,

General Tree in c/c++ Source Code, c++, source code,
General Tree in c/c++ Source Code, 

// asiment general tree.cpp : Defines the entry point for the console application.
//
 More :> Link List source code, Dynamic Array Source Code







#include "stdafx.h"

#include <stdio.h>
#include <stdlib.h>
#include <malloc.h>

#define SIZE 9

typedef struct treeNode
{
        int item;
        struct treeNode *left;
        struct treeNode *mid;
        struct treeNode *right;

}treeNode;


typedef int (*comparer)(int, int);

int compare(int a,int b)
{
    if(a < b)
        return 1;
    if(b<a<=b+5)
        return 2;
    if (a>b+5)
        return 3;
    return 0;
}
treeNode* create_node(int value)
{
    treeNode *new_node = (treeNode*)malloc(sizeof(treeNode));
    if(new_node == NULL)
    {
        fprintf (stderr, "Out of memory!!! (create_node)\n");
        exit(1);
    }
    new_node->item = value;

    new_node->left = NULL;
    new_node->mid = NULL;
    new_node->right = NULL;
    return new_node;
}
typedef int (*comparer)(int, int);
void insertNode(treeNode *root,comparer compare,int item)
{
if (root == NULL){
       root = create_node(item);
    }

   else{
        int is_left = 0;
        int is_mid = 0;
        int is_right = 0;
        int r;
        treeNode* cursor = root;
        treeNode* prev = NULL;
        while(cursor != NULL){
            r = compare(item,cursor->item);
            prev = cursor;
            if (r==1){
                is_left = 1;
                cursor = cursor->left;
            }else if(r==2){
                is_mid = 1;
                cursor = cursor->mid;
            }else if(r==3){
                is_right = 1;
                cursor = cursor->right;
            }
            }
        if(is_left)
           prev->left = create_node(item);
         else if(is_mid)
           prev->mid = create_node(item);
         else if(is_right)
           prev->right = create_node(item);

    else{
        printf("duplicate values are not allowed!");
    }
    return root;
}
treeNode * search(treeNode *root,const int item,comparer compare)
{
 if (root == NULL)
    return NULL;

 int r;
 treeNode* cursor = root;
 while (cursor!=NULL){
    r=compare(item,cursor->item);
    if(r==1)
        cursor = cursor->left;
    else if(r == 2)
        cursor = cursor->mid;
    else if(r == 3)
        cursor = cursor->right;
 }
 return cursor;

}
              //delete a node
treeNode* delete_node(treeNode* root,int item,comparer compare)
{
    if(root==NULL)
        return NULL;
    treeNode *cursor;
    int r = compare(item,root->item);
    if(r==1)
        root->left = delete_node(root->left,item,compare);
    else if(r==2)
        root->mid = delete_node(root->mid,item,compare);
    else if(r==3)
        root->right = delete_node(root->right,item,compare);
    else{
        if(root->left == NULL && root->mid == NULL)
            {
            cursor = root->right;
            free(root);
            root = cursor;
            }
        else if(root->left == NULL && root->right==NULL){
            cursor = root->mid;
            free(root);
            root = cursor;
        }
        else if(root->right == NULL && root->mid == NULL){
            cursor = root->left;
            free(root);
            root = cursor;
        }

    }

  return root;
}
void dispose(treeNode* root)
{
    if(root != NULL)
    {
        dispose(root->left);
        dispose(root->mid);
        dispose(root->right);
        free(root);
    }
}

void display(treeNode* nd)
{
    if(nd != NULL)
        printf("%d ",nd->item);
}
void display_tree(treeNode* nd)
{
    if (nd == NULL)
        return;
    /* display node item */
    printf("%d",nd->item);
    if(nd->left != NULL)
        printf("(L:%d)",nd->left->item);
    if(nd->mid != NULL)
        printf("(R:%d)",nd->mid->item);
    if(nd->right != NULL)
        printf("(R:%d)",nd->right->item);
    printf("\n");

    display_tree(nd->left);
    display_tree(nd->mid);
    display_tree(nd->right);
}


int main(void)
{
    treeNode* root = NULL;
    comparer int_comp = compare;



    int a[SIZE] = {8,3,10,1,6,14,4,7,13,15,2,5,20};
    int i;
    printf("--- C Binary Search Tree ---- \n\n");
    printf("Insert: ");
    for(i = 0; i < SIZE; i++)
    {
        printf("%d ",a[i]);
        root = insert_node(root,int_comp,a[i]);
    }
    printf(" into the tree.\n\n");

    /* display the tree */
    display_tree(root);

    /* remove element */
int r;
    do
    {
        printf("Enter data to remove, (-1 to exit):");
        scanf("%d",&r);
        if(r == -1)
            break;
        root = delete_node(root,r,int_comp);
        /* display the tree */
        if(root != NULL)
            display_tree(root);
        else
            break;
    }
    while(root != NULL);
    /* search for a node */

    int key = 0;
    treeNode* s;
    while(key != -1)
    {
        printf("Enter item to search (-1 to exit):");
        scanf("%d",&key);

        s = search(root,key,int_comp);
        if(s != NULL)
        {
            printf("Found it %d",s->item);
            if(s->left != NULL)
                printf("(L: %d)",s->left->item);
            if(s->mid != NULL)
                printf("(R: %d)",s->mid->item);
            if(s->right != NULL)
                printf("(R: %d)",s->right->item);
            printf("\n");
        }
        else
        {
            printf("node %d not found\n",key);
        }
    }

    /* remove the whole tree */
    dispose(root);
    return 0;
}
}


Dear Readers if you have any query/question feel free to ask me via comment box given below. Also Follow us on social media site and share that post with your friends. - See more at: http://onlinecomputercafe.blogspot.com

Link list in c/c++ source code, c++, source code,

Link list in c/c++ source code, c++,
Link list in c/c++ source code,  c++,

More: > Dynamic Array 










#include<iostream>

//------define struct new type and address----------//
//--------of next node take this struct-------------//

struct node{
int data;
node *next;
node()
{
data=0;
next=NULL;
}
};

//-------------------------------------------------//

node *head=NULL, *tail=NULL;
void add_end();
void add_start();
void delet_all();
void show();
void input(int d);

//------------------------------------------------//

//-----------main function------------------------//

void main()
{
int num,value;
char option;
cout<<"enter number of elements: ";
cin>>num;
//0-----------------------------------------------//

for(int i=0; i<num; i++)
{
cout<<"enter value to element: ";
cin>>value;
input(value);
}
//------------------------------------------------//

do{
cout<<endl;
cout<<"     to delete all press ....... = d "<<endl;
cout<<"     to add at start press ..... = a "<<endl;
cout<<"     to display all nodes ...... = p "<<endl;
cout<<"     to add at end press ....... = e "<<endl;
cout<<"     enter desired option....... =   ";
cin>>option;

//-----------switch statement---------------------//

switch (option)
{
case 'A':
case 'a':
add_start();
break;

case 'd':
case 'D':
delet_all();
break;

case 'P':
case 'p':
show();
break;

case 'E':
case 'e':
add_end();
break;
}
}
//-----------------------------------------------//

while(option!='x' && option!='X');

//-----function for delete all items of link list--//

delet_all();
}

void input(int d)
{
node *ptr;
if(head==NULL)
{
tail=new node;
tail->data=d;
tail->next=NULL;
head=tail;
}
else
{
// tail=tail->next;
ptr=tail;
tail=new node;
tail->data=d;
tail->next=NULL;
ptr->next=tail;

}
}
//-------------------------------------------------//

//------function to show element of linklist-------//

void show()
{
node *ptr;
ptr=head;
if(ptr==NULL)
cout<< "empty ... !!! ";
else
{
while(ptr!=NULL)
{
cout<<" "<<ptr->data;
ptr=ptr->next;
}
}
cout<<endl;
}

//------------------------------------------------//

//-----function to delete all element of----------//
//---------------link list------------------------//

void delet_all()
{
node *ptr,*prev;
ptr=head;
while(ptr->next!=NULL)
{
prev=ptr;
ptr=ptr->next;
delete prev;
}
head=NULL;
}
//-----------------------------------------------//

//--------function for adding element to---------//
//-------------link list at start----------------//

void add_start()
{
node *ptr;
ptr=new node;
int d;
cout<<"enter data to new node: ";
cin>>d;
ptr->data=d;
ptr->next=head;
head=ptr;
}
//----------------------------------------------//

//--------function for adding element to---------//
//-------------link list at end----------------//

void add_end()
{
node *ptr;
ptr=new node;
cout<<"enter data to new node: ";
cin>>ptr->data;
ptr->next=NULL;
tail->next=ptr;
}
//---------------------------------------------//




Dear Readers if you have any query/question feel free to ask me via comment box given below. Also Follow us on social media site and share that post with your friends. - See more at: http://onlinecomputercafe.blogspot.com 


Dynamic array source code, c++, source code,

Dynamic array source code, c++,
// dynamicarray.cpp : Defines the entry point for the console application.
//












#include "stdafx.h"
#include <iostream.h>
#include <process.h>
#include <cctype>

typedef int* IntPtr;
typedef int* intptr;

void input(IntPtr array,intptr array2,int &used)
{
cout<<"enter number = ";
cin>>array2[used];
cin>>array[used];
used++;
}
void addat(IntPtr p,int index,int used,int number)
{
IntPtr temp=0;
temp=p;
int j=0;
cout<<"TEmp = ";
for (int i=0;i<used;i++)
{
cout<<temp[i]<<",";
}
for (i=0,j=0;j<used;i++)
{
if (index==i && index==j)
{
p[i]=number;

} 
else
{
p[i]=temp[j];
j++;
}
}
used++;
}

void main(int argc, char* argv[])
{
IntPtr p,p2;
char ans;
int used=5;
p=new int;
p2=new int;
for(int i=0;i<used;i++)
{
p[i]=i+1;
}

do{
system("cls");



cout<<"_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-"<<endl;
    cout<<"==+===+===+==+===+===+===+===+===+===+==+==+==+===+===+===+===+===+===+==+==+"<<endl;
cout<<"\t"<<"\t"<<"+--> "<<" PRESS 'A' TO ADD"<<"\t"<<"\t"<<"    +"<<endl;
cout<<"==+===+===+==+===+===+===+===+===+===+==++==+===+===+===+===+===+===+==+====+"<<endl;
    cout<<"^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^"<<endl;
cout<<endl;
cout<<"Array = {";
for(int i=0;i<used;i++)
{

}
switch(toupper(ans))

{
case 'A':
{
input(p,p2,used);
for(int i=0;i<used;i++)
{
  p2=p;
}

break;

}
default:
{
cout<<"\t"<<"\t"<<"Invalid choice"<<endl;

}
cout<<"\t"<<"\t"<<"Execute again Y/N";
cin>>ans;
}

}while(ans=='y' || ans=='Y');
}



Dear Readers if you have any query/question feel free to ask me via comment box given below. Also Follow us on social media site and share that post with your friends. - See more at: http://onlinecomputercafe.blogspot.com 

Ordered and Un-ordered List in HTML Urdu/Hindi, html video tutorials,

Ordered and Un-ordered  List in HTML Urdu/Hindi,

Sunday, 20 September 2015

ONLINE QUIZ MANAGEMENT SYSTEM IN PHP, php fyp ideas,

PHP Projects Ideas For Final Year Students
ONLINE QUIZ MANAGEMENT SYSTEM IN PHP, php fyp ideas,

ONLINE QUIZ MANAGEMENT SYSTEM IN PHP

Online Quiz Management Project is the idea of organising online quiz. I have created this PHP quiz application for myself and It is online and performing well. You can check it here.

Functionality of online quiz project. 
  1. You can set title title
  2. You can set number of question in quizzes.
  3. You can set the time limit to complete the quiz,
  4. You can add new quizzes
  5. You can add multi answer question
  6. You can multiple type of type in the questions like images, video, audio etc.
  7. You can also allow the member to store the quiz score record for future.
  8. You can limit the number of attempt to take the quiz.

Dear Readers if you have any query/question feel free to ask me via comment box given below. Also Follow us on social media site and share that post with your friends. - See more at: http://onlinecomputercafe.blogspot.com

Tourism Final Year Project Idea, web ideas,

Tourism Final Year Project Idea, web ideas.
INTRODUCTION:
     Our project is about tourism named 3itourism. In which we store information about Locations, maps of Locations, information about Hotels etc.

PAGES: 
1. HOME PAGE
2. HOTELS
3. LOCATIONS
4. LOGIN
5. REGISTER
6. INFORMATION ABOUT GUIDES AND MUCH MORE


In locations we store information about each location which is prospective for tourism. We store the map of each location.
In Hotels we store the data about Hotels and restaurants for each location.
Review: 
        1st user have to register and then login to access data. User can find data about locations , hotels , restautants etc.

TOOLS TO BE USED:
1. ASP .NET
2. HTML
3. SQL SERVER

USER SPECIFICATION:


           User specification means user requirements here user have requirements which are below.
1. Information about locations
2. Information about hotel’s
3. Information about guides
4. Information about routes 
5. Information about weather

Etc.


Dear Readers if you have any query/question feel free to ask me via comment box given below. Also Follow us on social media site and share that post with your friends. - See more at: http://onlinecomputercafe.blogspot.com

Suspicious E-mail Detection, Desktop Final Year Project idea, web ideas,

Suspicious E-mail Detection, Desktop Final Year Project idea, web ideas,
Suspicious E-mail Detection
Aim
The aim of this project is to suspect the E-mails which consist of offensive, anti-social elements and block them which help in identifying the suspicious user.
Description
Suspicious email detection is a kind of mailing system where suspicious users are identified by determining the keywords used by him/her. The keywords such as bomb, RDX, are found in the mails which are sent by the user. All these blocked mails are checked by the administrator and identify the users who sent such mails.
MODULES     
 Modules in the Suspicious E-mail detection
  • Login Module
  • Registration Module
  • Administration Module
  • User Module
  • Mailing Module
1)    Login Module
This module is used by administrator and users (who are authenticated) to login into the secure mail. The login details of the specified person will be entered and hence can enter into the secure mail.
2)    Registration Module
This module is used by the unauthenticated users who are unregistered. The users must register themselves such that they can login into the secure mail.
3)    Administration Module
This module is used by the administrator to perform the functions like managing the keywords, entering new keywords and to check out the block list of the discarded mails.
4)    User Module
      This module is used by the users to do operations like composing mail, checking out the mails in inbox and finally sending the mails to the authenticated users by attaching a message.
5)    Mailing Module
       This module is used by the users perform mailing system. The mailing system consists of composing the mails, sending the mails and checking out the mails in inbox.
Software Requirements
      • Operating System :: Windows NT/2000
      • Server Side :: JSP with Tomcat Server
      • Client Side :: HTML ,JavaScript
      • Services :: JDBC
      • Database :: Oracle 10g/XE
      • Integrated Development Environment :: My Eclipse 6.0





Dear Readers if you have any query/question feel free to ask me via comment box given below. Also Follow us on social media site and share that post with your friends. - See more at: http://onlinecomputercafe.blogspot.com

LinkWithin