Posts

A program that dynamicaly allocates memory and increases and decreases size of array using stack.Initially array is of size 10.

#include "stdafx.h" #include <iostream> using namespace std; class stack { private :       int *lifo;                   int top,size; public :       stack()       {             lifo= new int [10];             size=10;             top=0;       }       void push( int temp)             {                               lifo[top++]=temp;             if (top>size-1) {  ...

C++ Matrix Multiplication

// matrix.cpp : Defines the entry point for the console application. // #include "stdafx.h" #include <iostream> using namespace std; int _tmain(int argc, _TCHAR* argv[]) { //Here i am using a two dimensional arrayof size 2 you can use array of any size. //Also you can input values in array here i am giving values at compile time.  int A[2][2]={1,2,3,4};  int B[2][2]={4,3,2,1};  int C[2][2];  int i, j, k;     int sum;                 for (i = 0; i < 2; i++)  {                     for (j = 0; j < 2; j++)   {                             sum = 0;          ...

SQL Procedures

SQL Procedures: Procedures : Procedures are like functions. Procedures are easy to execute and save your time. you do not have to write whole the sql statement again and again. You only have to call the procedure. You must create the table before you can apply procedure on the table. Here I am applying procedures on doctor table General syntax for procedures: create procedure Procedure_Name (   --Parameters ) as begin --Your sql statements End Procedure for inserting records: Create a procedure and specify number of Parameters that will be passed to procedure. Parameters are the columns of table in which you want to insert the record. Number of Parameters should be equal to number of columns of the table . create procedure insertdoc ( @Doctor_Id int ,                                 --Here goes your Parameters @Doc...

SQL Triggers

SQL Triggers: Triggers are like events which can be fired after performing some operation. Triggers are fired when some modification to data is performed. Triggers can be fired after update,delete and insert operations. General Syntax For Creating a Trigger: create trigger trigger_name on table_name AFTER insert,update,delete   as statements to be executed after trigger fires   Trigger Which Fires After update: Let's see what this trigger do. Give trigger name as in examle that is(updatetrig) then specify table name as(doctor) in example create trigger updatetrig on doctor -- Define when trigger fires as in this case it fires after update   AFTER update as --Define what to perform when trigger fires select * from doctor where doctor_id = 'd101'     --To fire trigger update a record in the table update doctor set name = 'mairaj' where doctor_id = 'd101' Trigger Which Fires After Delete: create trigger deltrig on doctor --Yo...

To find fisrt and second maximum number using pointers in c++

// max.cpp : Defines the entry point for the console application. //Finds second maximum number in the array. #include "stdafx.h" #include <iostream> using namespace std; //Define a function max which gives maximun and second maxium number. //Pass two int variables by-refernce and an array. void max( int [], int *, int *); int _tmain( int argc, _TCHAR* argv[]) {       //Define three int variables and an array of your required size. int max1,max2,i,a[10];         cout<< "enter array elements" <<endl; //Input value of array elements.       for (i=0;i<10;i++)              //Loop for input.       {       cin>>a[i];       }       max(a,&max1,&max2);           ...