c programs

What are C Tokens?

What are C Tokens?

C programs contains many elements which are identified by the compiler as Tokens. Tokens can be categorized as 1. Keywords2. Variables3. Constants 4. Special characters 5. Operators C Token example program: int main() { int x, y, sum; x = 5, y = 10; sum = x + y; Printf (“Sum = %d \n”, sum); […]

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 queue operations

C program to implement queue operations

Below is the C program to implement various queue operations, 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 […]

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

C Program which performs stack operations

C Program which performs stack operations

Following program performs various stack operations, 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 […]

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 sorting a Linked List

C program for sorting a Linked List

C program for sorting a Linked List. #include<stdio.h> #include<dirent.h> #include<malloc.h> #include<string.h>   void main (int argc,char * argv[]) { DIR * directory_pointer; struct dirent* entry; struct File list { char filename[64]; struct File * new; } start,*node,* previous, * new; if((directory_pointer=opendir(argv[1]))==NULL) printf("Error opening %s\n", argv[1]); else { start.next + NULL; while (entry = readdir (directory_pointer)) […]

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 to print student details using constructor and destructor

C++ program to print student details using constructor and destructor

CONSTRUCTOR AND DESTRUCTOR AIM: A program to print student details using constructor and destructor ALGORITHAM: 1. Start the process 2. Invoke the classes 3. Call the read() function a. Get the inputs name ,roll number and address 4. Call the display() function a. Display the name,roll number,and address of the student 5. Stop the process […]

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 circular queue ADT using an array

C++ program to implement circular queue ADT using an array

/* Write a C++ program to implement circular queue ADT using an array */ #include<iostream> #include<conio.h> #include<stdlib.h> using namespace std; class cqueue { int q[5],front,rare; public: cqueue() { front=-1; rare=-1; } void push(int x) { if(front ==-1 && rare == -1) { q[++rare]=x; front=rare; return; } else if(front == (rare+1)%5 ) { cout <<" Circular […]

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 Queue ADT using an array

C++ programs to implement the Queue ADT using an array

/* Write C++ programs to implement the Queue ADT using an array */ #include<iostream> #include<conio.h> #include<stdlib.h> using namespace std;   class queue { int queue1[5]; int rear,front; public: queue() { rear=-1; front=-1; } void insert(int x) { if(rear > 4) { cout <<"queue over flow"; front=rear=-1; return; } queue1[++rear]=x; cout <<"inserted" <<x; } void delet() […]

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