Posts

Showing posts from June 25, 2009

Ball joint

A flexible ball-and-socket joint used primarily in front suspension units because it can accommodate a wide range of angular motion. The ball joint offers relatively free movement between components while holding them together.

Balancer Shafts

Generally employed in pairs. these are contra- rotating shafts, geared together and carrying opposed balance weights. They can be driven at engine speed to cancel out primary reciprocating imbalance, as in old Ford W engines and some three-cylinder units. More usually driven at twice engine speed to smooth out vibrations caused by secondary imbalance. as found in four-cylinder Mitsubishi engines.

Balance In Engines

The process of canceling out the forces created by imbalance in rotating components and by the reciprocation of pistons and conrods. imbalance creates internal stresses In engine structure and causes unwanted external vibrations that are fed into the body shell — bad for reliability as well as comfort. Rotational imbalances are easily corrected: but balances of reciprocating masses are much more difficult. Reciprocating imbalance can be categorized mainly as primary [oscillating at engine speed} and secondary (oscillating at twice engine speed}. The best approach is to balance the motion of one piston against that of another - thus straight-six, VS and V12 engines can have perfect primary and secondary balance. An ordinary In-line four is in primary balance only - hence the use of balancer shafts.

Baffled Sump

The oil pans or sumps of same competition engines have thin metal plates or baffles that reduce the amount the oil as sloshed around under hard comering and other heavy gravitational forces. This stops the engine being starved of oil when running at high rpm.

backfire

When a fresh unburned charge of fuel combusts in the exhaust system due to leakage from an open exhaust valve. It is known as backfire. It is sometimes heard on trailing throttle as a car slows down.

Backbone Chassis

A Structure. often in the form of a large-diameter tube, running down the centre of a car, with seats and suspension on each side. which takes all the major chassis leads of a car. Used for the Volkswagen Beetle and extensively by Lotus. it is a sensible arrangement fur an open spans car but It Is not the most effective route to maximum torsional stiffness. monocoque chassis are more widespread.

Back Pressure

When there is some form of resistance to the free flow at the exhaust from the cylinder head, the resultant condition is known as back pressure. This can be a result of a badly made exhaust system or due to lhe pour condition of either the catalytic converter or the mufflers.

implimentation of Breadth First Search

#include #include class node { public: int queue[50]; int a[50][51]; void enqueue(int); int dequeue(); void bfs(int); } node1; int n,e,front=0; int rear=-1; void node::enqueue(int x) { queue[(++rear)%50]=x; } int node::dequeue() { int x=queue[front]; front=(front+1)%50; return(x); } void node::bfs(int x) { int b; a[x][50]=1; enqueue(x); while(((rear+1)%50)!=front) { b=dequeue(); cout<<" "< for(int i=0;i { if(a[b][i]==1) if(a[i][50]==0) { a[i][50]=1; enqueue(i); } } } } void main() { int i,x,y; clrscr(); for(i=0;i { node1.a[i][50]=0; for(int j=0;j node1.a[i][j]=0; } cout<<"\n Enter the number of vertices: "; cin>>n; cout<<"\n Enter the number of edges: "; cin>>e; cout<<"\n Enter the Source & Destination Vertex: \n"; for(i=0;i { cout<<"\n Enter th

implimentation of BINARY SEARCH TREE

// BINARY SEARCH TREE #include #include class btree { private: struct btreenode { btreenode *leftchild; int data; btreenode *rightchild; }*root; public: btree(); void buildtree(int num); static void insert(btreenode **sr,int num); void traverse(); static void inorder(btreenode *sr); static void preorder(btreenode *sr); static void postorder(btreenode *sr); static void del(btreenode *sr); ~btree(); }; btree::btree() { root=NULL; } void btree::buildtree(int num) { insert(&root,num); } void btree::insert(btreenode **sr,int num) { if(*sr==NULL) { *sr=new btreenode; (*sr)->leftchild=NULL; (*sr)->data=num; (*sr)->rightchild=NULL; return; } else { if(num<(*sr)->data)insert(&((*sr)->leftchild),num); else insert(&((*sr)->rightchild),num); } return; } void btree::traverse() { cout<<"\n lnorder traverse"; inorder(root); cout<<"\n Preorder traverse"; preorder(root); cout<<"\n Postorder traverse"

implimentation of circular linked list using c++

#include #include #include # define NULL 0 struct linked_list { int number; linked_list*next; }; typedef linked_list node; node*head; node*tail; node*p; int s=0; class linkedlist { public: void creat(); void print(); void insert(); void del(); }; void main() { clrscr(); int ch; linkedlist llist; char choice='y'; while(choice=='y') { cout<<" \t\t\t Menu"< cout<<" \t\t\t ~~~~"< cout<<"1.Creat"< cout<<"2.Insert"< cout<<"3.Delete"< cout<<"4.Print"< cout<<"5.Exit"< cout<<"Enter your choice"< cin>>ch; switch(ch) { case 1: llist.creat(); break; case 2: llist.insert(); break; case 3: llist.del(); break; case 4: llist.print(); break; case 5: exit(0); }

CLASS TEMPLATE using c++ program

// CLASS TEMPLATE #include #include template class pair { t v1,v2; public: pair(t first,t second) { v1=first; v2=second; } t getmax() { return(v1>v2?v1:v2); } }; void main() { int a,b; float c,d; clrscr(); cout<<"enter two integers"; cin>>a>>b; cout<<"enter two decimel numbers"; cin>>c>>d; pair intobj(a,b); pair flobj(c,d); cout<<"max integer is:"< cout<<"\n max float is :"< getch(); }

implementation of depth first search

#include #include class node { public: int a[50][51]; void dfs(int); } node1; int n,e; void node::dfs(int x) { cout<<" "< a[x][50]=1; for(int i=0;i { if(a[x][i]==1) if(a[i][50]==0) dfs(i); } } void main() { int i,x,y; clrscr(); for(i=0;i { node1.a[i][50]=0; for(int j=0;j node1.a[i][j]=0; } cout< cin>>n; cout<<"Enter the number of edges"; cin>>e; for(i=0;i { cout<<"\n Enter the "< cin>>x; cout<<"to"; cin>>y; x--; y--; node1.a[x][y]=1; node1.a[y][x]=1; } cout<<"\n your depth first search is:"; if(n>0) for(i=0;i { if(node1.a[i][50]==0) { node1.dfs(i); cout<<"\t\t"; } } else cout<<"\n Empty"; getch(); }

IMPLEMENTATION OF DOUBLY LINKED LIST

#include #include #include #define NULL 0 struct linked_list { int number; linked_list *next; linked_list *previous; }; typedef linked_list node; class linkedlist { public: void create(node *head); void print(node *head); node *insert(node *head); node *del(node *head); }; void main() { clrscr(); int ch; linkedlist llist; node *head; head=new node; char choice='y'; while(choice=='y') { cout<<"\n\nMENU"< cout<<"~~~~"; cout<<"\n1.Create \n2.Insert \n3.Delete \n4.Print \n5.Exit"; cout<<"\n Enter your choice"< cin>>ch; switch(ch) { case 1:llist.create(head); break; case 2:head=llist.insert(head); break; case 3:head=llist.del(head); break; case 4:llist.print(head); break; case 5:exit(0); } cout<<"Do you want to continue(Y/N)"< cin>>choice; } getch(); } void linkedlist

friend function using c++ program

// FRIEND FUNCTION #include #include class matrix { private: int a[5][5],c[5][5]; public: int m,n; void input(); friend matrix operator*(matrix m1,matrix m2); void display(); }; void matrix::input() { cout<<"enter the no of rows"; cin>>m; cout<<"enter the no of columns"; cin>>n; cout<<"enter the elements of matrixA \n"; for(int i=0;i { for(int j=0;j { cin>>a[i][j]; } } } matrix operator*(matrix m1,matrix m2) { matrix m3; int i,j; for(i=0;i { for(j=0;j { m3.c[i][j]=0; for(int k=0;k<2;k++) { m3.c[i][j]=m3.c[i][j]+m1.a[i][k]*m2.a[k][j]; } } } return(m3); } void matrix::display() { cout<<" \n"; cout<<"the product of both matrix is \n"; for(int i=0;i<2;i++) { for(int j=0;j<2;j++) { cout< } cout< } } void main() {

prefix to postfix

#include #include #include char inf[240],post[40]; int top=0, st[20]; void postfix(); void infix(); char pop(); main() { clrscr(); cout<<"Infix to Postfix"; cout<<"\n Enter ninfix expression"; cin>>inf; getch(); } void postfix() { int i,j=0; for(i=0,inf[i]!=0;i++) { switch(inf[i]) { case'+'; while(st[top]>=1) post[j++]pop(); push(1); break; case'-'; while(st[top]>=2) post[j++]pop(); push(2); break; case'*'; while(st[top]>=3) post[j++]pop(); push(3); break; case'/'; while(st[top]>=4) post[j++]pop(); push(4); break; case'('; push(0); break;

MULTI-LEVEL INHERITANCE

// MULTI-LEVEL INHERITANCE #include #include class student { protected: int rollno; char name[30]; public: void getdata() { cout<<"enter the student name:"< cin>>name; cout<<"enter the roll no"<<"\n"; cin>>rollno; } void putdata() { cout<<"name"< cout<<"roll no"< } }; class test:public student { protected: int m1,m2,m3; public: void getmarks() { cout<<"enter the marks"< cin>>m1>>m2>>m3; } void putmarks() { cout<<"english :"< cout<<"maths :"< cout<<"chemistry:"< } }; class result:public test { protected: int total; float avg; public: void display() { total=m1+m2+m3; avg=total/3; cout<<" \n\n \t\tSTUDENT DETAILS"< putdata(); putmarks(); cout<<"total :"&l

MULTIPLE INHERITANCE using c++

// MULTIPLE INHERITANCE #include #include class m { protected: int a; public: void get_m(int); }; class n { protected: int b; public: void get_n(int); }; class p:public m,public n { public: void display(); }; void m::get_m(int x) { a=x; } void n::get_n(int y) { b=y; } void p::display() { cout<<"\n\nOUTPUT :\n"; cout<<"The value of a="< cout<<"The value of b="< cout<<"The product a*b="< } void main() { int a,b; clrscr(); p obj; cout<<"enter the value of a&b"< cin>>a>>b; obj.get_m(a); obj.get_n(b); obj.display(); getch(); }

OPERATOR OVER-LOADING

// OPERATOR OVER-LOADING #include #include class unary { public: int x; int y; public: void get_x() { cout<<"\n\nEnter a value:"; cin>>x; } int dis_y() { cout< return 0; } unary operator++(); unary operator++(int a); unary operator--(); unary operator--(int a); }; unary unary::operator++() { unary temp; temp.y=++x; return(temp); } unary unary::operator++(int) { unary temp; temp.y=x++; return(temp); } unary unary::operator--() { unary temp; temp.y=--x; return(temp); } unary unary::operator--(int) { unary temp; temp.y=x--; return(temp); } int main() { clrscr(); cout<<"\n OUTPUT"; unary c1,c2; c1.get_x(); cout< cout<<"\n PRE_INCREMENT:"; c2=++c1; c2.dis_y(); cout< c1.get_x(); cout<<"\n POST_INCREMENT:"; c2=c1++; c2.dis_y(); cout< c1.get_x(); cout<<"\n PRE_DECREMENT:"; c2=--c1; c2.dis_y(); cout&l

polynomial manipulation using c++

# include # include class poly { private: struct polynode { float coeff; int exp; polynode *link; }*p; public: poly(); void poly_append(float c,int e); void display_poly(); void poly_add(poly &i1,poly &i2); ~poly(); }; poly::poly() { p=NULL; } void poly::poly_append(float c,int e) { polynode *temp=p; if(temp==NULL) { temp=new polynode; p=temp; } else { while(temp->link!=NULL) temp=temp->link; temp->link=new polynode; temp=temp->link; } temp->coeff=c; temp->exp=e; temp->link=NULL; } void poly::display_poly() { polynode *temp=p; int f=0; cout< while(temp!=NULL) { if(f!=0) { if(temp->coeff>0) cout<<"+"; else cout<<" "; } if(temp->exp!=0) cout< coeff<<"x^"< exp; else cout< coeff; temp=te

post fix

#include #include #include const int MAX=50; class postfix { private: char stack[MAX][MAX],target[MAX]; char temp1[2],temp2[2]; char str1[MAX],str2[MAX],str3[MAX]; int i,top; public: postfix(); void setexpr(char *c); void push(char *str); void pop(char *a); void convert(); void show(); }; postfix::postfix() { i=0; top=-1; strcpy(target," "); } void postfix::setexpr(char *c) { strcpy(target,c); } void postfix::push(char *str) { if(top==MAX-1) cout< else { top++; strcpy(stack[top],str); } } void postfix::pop(char *a) { if(top==-1) cout< else { strcpy(a,stack[top]); top--; } } void postfix::convert() { while(target[i]) { if(target[i]==' ') i++; if(target[i]=='%'||target[i]=='*'||target[i]=='-'||target[i]=='+'||target[i]=='/'|target[i]=='$') { pop(str2); pop(str3); temp1[0]=target[i]; temp1[1]='\0'; strcpy(str1,str3); strcat(str1,temp1); strcat(s

implementing queue using c++

#include #include #include template class Queue{ struct node { object data; node *next; }*front,*rear; public: Queue() { front=rear=NULL; } void Enqueue (); void Dequeue (); int IsEmpty (); void display (); }; template void Queue ::Enqueue () { object item; node *newnode; char ch; newnode = new node; cout<<"\n enter the item to be inserted:\t"; cin>>item; newnode->data = item; newnode->next = NULL; if(rear==NULL) { rear = newnode; if(front==NULL) front = newnode; } else { rear->next=newnode; rear=newnode; } } template void Queue ::Dequeue() { object item; node*nodeptr; if (front==NULL) cout<<"\n Queue is Empty"; else { nodeptr = front; front = front->next; if(front==NULL) rear=front; cout<<"\n deleted item is:\t"< data; delete nodeptr; } } template void Queue ::display () { object item; node *nodeptr; if(front==NULL) cout<<"\n queue is

quick sort using a c++ program

#include #include int n; class quicksort { public: int a[10]; void input(); void qsort(int,int); void output(); void swap(int &,int &); int median(int,int); }; void quicksort::input() { int i; cout<<"\t\tQuick Sort"; cout<<"\n\t\t~~~~~ ~~~~"; cout<<"\n\n Enter the size of array"; cin>>n; cout<<"\n Enter the array elements:"; for(i=0;i cin>>a[i]; } int quicksort::median(int left,int right) { int center=(left+right)/2; if(a[center] swap(a[left ],a[center]); if(a[right] swap(a[left],a[right]); if(a[right] swap(a[center],a[right]); swap(a[center],a[right-1]); return(a[right-1]); } void quicksort::output() { cout<<"\n Sorted elements are"; for(int i=0;i cout<<" "< } void quicksort::swap(int &a,int &b) { int t; t=a; a=b; b=t; } void quicksort::qsort(in

IMPLEMENTATION OF SINGLY LINKED LIST using c++ program

#include #include #include #define NULL 0 struct linked_list { int number; linked_list *next; }; typedef linked_list node; class linkedlist { public: void create(node *head); void print(node *head); node *insert(node *head); node *del(node *head); }; void main() { clrscr(); int ch; linkedlist llist; node *head; head=new node; char choice='y'; while(choice=='y') { cout<<"\n\nMENU"< cout<<"~~~~"; cout<<"\n1.Create \n2.Insert \n3.Delete \n4.Print \n5.Exit"; cout<<"\n Enter your choice"< cin>>ch; switch(ch) { case 1:llist.create(head); break; case 2:head=llist.insert(head); break; case 3:head=llist.del(head); break; case 4:llist.print(head); break; case 5:exit(0); } cout<<"Do you want to continue(Y/N)"< cin>>choice; } getch(); } void linkedlist::create(node *list) {

stack functions using a c++ program

#include #include #include //#include template class stack { struct node { object data; node *next; } *TOS; public: stack () { TOS=NULL; } void create (); void push (); void pop (); void display (); }; template void stack :: push () { object item; node *newnode; char ch; new node; cout<<"\n Enter the item to be inserted:\t"; cin>>item; newnode = new node; newnode->data=item; newnode->next=NULL; if (TOS==NULL) TOS = newnode; else { new node->next=TOS; TOS=new node; } } template void stack ::pop() { object item; node*nodeptr; if(TOS==NULL) cout<<"\n stack is empty"; else { nodeptr=TOS; TOS=TOS->next; cout<<"\n deleted item is:\t"< data; delete nodeptr; } } template void stack ::display() { object item; node*nodeptr; if(TOS==NULL) cout<<"\n stack is empty\n"; else { cout<<"\n item in the stack are\n"; nodeptr=TOS; while(nodeptr) { cout<<"\t"< data; nodeptr=nodeptr->n

string manipulation using a c++ program

#include #include #include void main() { char s1[10],s2[10],s3[10]; int opt; char choice='y'; clrscr(); while(choice=='y') { cout<<"\n Menu\n\n1. string length\n2. string copy\n3. string concadenation\n4. string comparison\n5.exit"; cout<<"\n enter your choice:"; cin>>opt; switch(opt) { case 1: cout<<"\n enter a name:"; cin>>s3; cout<<"\n the length of the string is:"< break; case 2: cout<<"\n enter a name:"; cin>>s1; cout<<"\n the original string is :"< strcpy(s2,s1); cout<<"\n the copied string is:"< break; case 3: cout<<"\n enter two names:"; cin>>s1>>s2; cout<<"\n concatenated string is:"< break; case 4: cout<<"\n enter two names:"; cin>>s1>>s2; if(strcmp(s2,s1)=='\0') { cout<<"\n the string are equal

STUDENT DETAILS

#include #include class student { protected: int rollno; char name[30]; public: void getdata() { cout<<"Enter the studend name:"< cin>>name; cout<<"Enter the roll no:"<<"\n"; cin>>rollno; } void putdata() { cout<<"Name:"< cout<<"rollno:"< } }; class test:public student { protected: int l,m1,m2,m3; public: void getmarks() { cout<<"Enter the marks:"< cin>>m1>>m2>>m3; } void putmarks() { cout<<"Mark1:"< cout<<"Mark2:"< cout<<"mark3:"< } }; class result:public test { protected: int total; float avg; public: void display() { total=m1+m2+m3; avg=total/3; cout<<"\n\n\t\tStudent details"< cout<<"Name ="< cout<<"rollno ="< cout<<"m1 ="<

SWAPPING OF TWO NUMBERS

#include #include class swap { int a,b,t; public: void value(int,int); void ref(int&,int&); void addr(int*,int*); }; void swap::value(int a,int b) { cout<<"enter the numbers to be swapped"; cin>>a; cin>>b; int t; t=a; a=b; b=t; cout<<"\n The numbers after swapping are \n "< } void swap::ref(int &a,int &b) { cout<<"enter the numbers to be swapped"; cin>>a; cin>>b; int t; t=a; a=b; b=t; cout<<"\n The numbers after swapping are \n"< } void swap::addr(int *a,int *b) { cout<<"enter the numbers to be swapped"; cin>>*a; cin>>*b; int t; t=*a; *a=*b; *b=t; cout<<"\n The numbers after swapping are \n"<<*a<<"\t"<<*b; } void main() { int a,b,opt; swap sp; clrscr(); do { cout<<"\n\n\tMENU\n"; cout<<"\t--------\

VIRTUAL FUNCTION

VIRTUAL FUNCTION #include #include class shape { protected: double x,y,z; public: void get_area(double x1,double y1,double z1) { x=x1; y=y1; z=z1; } virtual void disp()=0; }; class rect:public shape { void disp() { cout<<"area of rectangle="<< x*y <<"\n"; cout<<"\n"; } }; class tria:public shape { void disp() { cout<<"area of triangle="<<(x*y)/2<<"\n"; cout<<"\n"; } }; class cir:public shape { void disp() { cout<<"area of circle="<<(3.14*y*y)<<"\n"; cout<<"\n"; } }; int main() { float x,y,z; clrscr(); cout<<"enter the value of x,y,z\n"; cin>>x>>y>>z; shape *p; rect r; p=&r; p->get_area(x,y,z); p->disp(); tria t; p=&t; p->get_area(x,y,z); p->disp(); cir c; p=&c; p->get_area(x,y,z); p->disp(); getch(); return 0; }