free

What is the difference between new and malloc?

What is the difference between new and malloc?

Here are the differences between new and malloc, Operator new constructs an object (calls constructor of object), malloc does not. Hence new invokes the constructor (and delete invokes the destructor)This is the most important difference. operator new is an operator, malloc is a function. operator new can be overloaded, malloc cannot be overloaded. operator new […]

Share on FacebookTweet about this on TwitterDigg thisPin on PinterestShare on LinkedInShare on StumbleUponShare on TumblrShare on Google+Email this to someone

C program to Implement Morse code to text conversion and vice-versa.

C program to Implement Morse code to text conversion and vice-versa.

C program to Implement Morse code to text conversion and vice-versa. #include<stdio.h> #include<conio.h> #include<string.h> #include<process.h>   void main() { char str[25],str1[100]; clrscr(); fflush(stdin); printf("enter the String"); gets(str);   int j=0; for(int i=0;i<=strlen(str);++) { switch(toupper(str[i])) { case ‘A’: str1[j++]=’.’; str1[j]=’.’; break;   case ‘b’: str1[j++]=’.’; str1[j++]=’.’; str1[j++]=’.’; str1[j]=’.’; break;   case ‘c’: str1[j++]=’.’; str1[j++]=’.’; str1[j++]=’.’; str1[j]=’.’; […]

Share on FacebookTweet about this on TwitterDigg thisPin on PinterestShare on LinkedInShare on StumbleUponShare on TumblrShare on Google+Email this to someone

C++ program to calculate the factorial of a number using recursion.

C++ program to calculate the factorial of a number using recursion.

Write a program to calculate the factorial of a number using recursion. #include<iostream.h> #include<conio.h> void main() { int n,fact; int rec(int); clrscr(); cout<<"Enter the number:->"; cin>>n; fact=rec(n); cout<<endl<<"Factorial Result are:: "<<fact<<endl; getch(); } rec(int x) { int f; if(x==1) return(x); else { f=x*rec(x-1); return(f); } }

Share on FacebookTweet about this on TwitterDigg thisPin on PinterestShare on LinkedInShare on StumbleUponShare on TumblrShare on Google+Email this to someone

C program for Syntax Analyzer

C program for Syntax Analyzer

C program for Syntax Analyzer #include<stdio.h> #include<conio.h> #include<string.h> #include<ctype.h> void main() { int i,j,k=0,count,inc=0,n; char name[30],open[30],ch,chh,o[30]; char op[20]={’=’,’+’,’-’,’*’,’/’,’%’,’^’,’&’,’|’}; clrscr(); textcolor(3); cprintf("–Syntax Analyser–"); printf("\n"); printf("\n Enter Syntax"); printf("\n"); scanf("%s",name); n=strlen(name); for(i=0;i<n;i++) { ch=tolower(name[i]); for(j=0;j<9;j++) { if(ch==op[j]) { open[k]=i; o[k]=ch; k++; } } } for(i=0;i<k;i++) { count=open[i]; ch=tolower(name[count-1]); chh=tolower(name[count+1]); if(isalpha(ch)&&isalpha(chh)||isdigit(chh)) ++inc; } if(k==inc) printf("\n %s is a […]

Share on FacebookTweet about this on TwitterDigg thisPin on PinterestShare on LinkedInShare on StumbleUponShare on TumblrShare on Google+Email this to someone

C program for Priority Scheduling

C program for Priority Scheduling

C program for Priority Scheduling #include<stdio.h> #include<conio.h> #include<iostream.h> void main() { clrscr(); int x,n,p[10],pp[10],pt[10],w[10],t[10],awt,atat,i; printf("Enter the number of process : "); scanf("%d",&n); printf("\n Enter process : time priorities \n"); for(i=0;i<n;i++) { printf("\nProcess no %d : ",i+1); scanf("%d %d",&pt[i],&pp[i]); p[i]=i+1; } for(i=0;i<n-1;i++) { for(int j=i+1;j<n;j++) { if(pp[i]<pp[j]) { x=pp[i]; pp[i]=pp[j]; pp[j]=x; x=pt[i]; pt[i]=pt[j]; pt[j]=x; x=p[i]; p[i]=p[j]; […]

Share on FacebookTweet about this on TwitterDigg thisPin on PinterestShare on LinkedInShare on StumbleUponShare on TumblrShare on Google+Email this to someone

C progrma for First Come First Serve Algorithm

C progrma for First Come First Serve Algorithm

C progrma for First Come First Serve Algorithm #include<stdio.h> #include<math.h> #include<conio.h> void main() { clrscr(); int p[20],b[20],w[20],t[20],i,v,n,at; int wt=0; float tw,tr; printf("Enter the number of process : "); scanf("%d",&n); printf("enter CPU burst time : "); for(i=1;i<=n;i++) { scanf("%d",&b[i]); t[1]=b[1]; w[1]=0; at=t[1]; wt=w[1]; for(i=2;i<=n;i++) { t[i]=b[i]+t[i-1]; at=at+t[i]; w[i]=t[i-1]; wt=wt+w[i]; } } printf("process \t burst_time \t wait_time […]

Share on FacebookTweet about this on TwitterDigg thisPin on PinterestShare on LinkedInShare on StumbleUponShare on TumblrShare on Google+Email this to someone

C++ programs to implement the Prim’s algorithm to generate a minimum cost spanning tree

C++ programs to implement the Prim’s algorithm to generate a minimum cost spanning tree

/* Write C++ programs to implement the Prim’s algorithm to generate a minimum cost spanning tree */ #include<iostream> #include<conio.h> #include<stdlib.h> using namespace std; int cost[10][10],i,j,k,n,stk[10],top,v,visit[10],visited[10],u;   main() { int m,c; cout <<"enterno of vertices"; cin >> n; cout <<"ente no of edges"; cin >> m; cout <<"\nEDGES Cost\n"; for(k=1;k<=m;k++) { cin >>i>>j>>c; cost[i][j]=c; } for(i=1;i<=n;i++) […]

Share on FacebookTweet about this on TwitterDigg thisPin on PinterestShare on LinkedInShare on StumbleUponShare on TumblrShare on Google+Email this to someone

C graphics program for analog clock

C graphics program for analog clock

Time_Dig[0]=hour/10+48;
Time_Dig[1]=hour%10+48;
Time_Dig[2]=’:’;
Time_Dig[3]=min/10+48;
Time_Dig[4]=min%10+48;
Time_Dig[5]=’:’;
Time_Dig[6]=sec/10+48;

Share on FacebookTweet about this on TwitterDigg thisPin on PinterestShare on LinkedInShare on StumbleUponShare on TumblrShare on Google+Email this to someone