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 cin>>n; cout cin>>e; cout for(i=0;i { cout cin>>x; cout cin>>y; x--; y--; node1.a[x][y]=1; node1.a[y][x]=1; } cout if(n>0) for(i=0;i { if(node1.a[i][50]==0) { node1.bfs(i); cout } } else cout getch(); }

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 data)insert(&((*sr)->leftchild),num); else insert(&((*sr)->rightchild),num); } return; } void btree::traverse() { cout inorder(root); cout preorder(root); cout postorder(root); } void btree::inorder(btreenode *sr) { if(sr!=NULL) { inorder(sr->leftchild); cout data; inorder(sr->rightchil...

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 cout cout cout cout cout cout cout 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); } cout cin>>choice; } getch(); } void linkedlist::creat() { int f1=0,f2=0; node*list; list=new node; do { cout cin>>list->number; if(f1==0) { head=list; f1=1; } if(list->number==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 cin>>a>>b; cout cin>>c>>d; pair intobj(a,b); pair flobj(c,d); cout cout 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 cin>>e; for(i=0;i { cout cin>>x; cout cin>>y; x--; y--; node1.a[x][y]=1; node1.a[y][x]=1; } cout if(n>0) for(i=0;i { if(node1.a[i][50]==0) { node1.dfs(i); cout } } else cout 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 cout cout cout 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 cin>>choice; } getch(); } void linkedlist::create(node *list) { node*cur; cur=new node; cur->previous=NULL; int f=0; do { cout cin>>list->number; if(list->number==0) { list->previous=cur; list->next=NULL; f=1; } else { ...

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 cin>>m; cout cin>>n; cout 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 { m3.c[i][j]=m3.c[i][j]+m1.a[i][k]*m2.a[k][j]; } } } return(m3); } void matrix::display() { cout cout for(int i=0;i { for(int j=0;j { cout } cout } } void main() { matrix m1,m2,m3; clrscr(); m1.input(); m2.input(); m3=m1*m2; m3.display(); getch(); }

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 cout 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 cin>>name; cout cin>>rollno; } void putdata() { cout cout } }; class test:public student { protected: int m1,m2,m3; public: void getmarks() { cout cin>>m1>>m2>>m3; } void putmarks() { cout cout cout } }; class result:public test { protected: int total; float avg; public: void display() { total=m1+m2+m3; avg=total/3; cout putdata(); putmarks(); cout cout } }; void main() { clrscr(); result x; x.getdata(); x.getmarks(); x.display(); getch(); }

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 cout cout cout } void main() { int a,b; clrscr(); p obj; cout 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 >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 unary c1,c2; c1.get_x(); cout cout c2=++c1; c2.dis_y(); cout c1.get_x(); cout c2=c1++; c2.dis_y(); cout c1.get_x(); cout c2=--c1; c2.dis_y(); cout c1.get_x(); cout c2=c1--; c2.dis_y(); cout getch(); return 0; }

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 exp; else cout coeff; temp=temp->link; f=1; } } void poly::poly_add(poly &i1,poly &i2) { ...

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(str1,str2...

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 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 else { nodeptr = front; front = front->next; if(front==NULL) rear=front; cout data; delete nodeptr; } } template void Queue ::display () { object item; node *nodeptr; if(front==NULL) cout else { cout nodeptr = front; while (nodeptr) { cout data; nodeptr = nodeptr->next; } } } void main() { Queue Q; int opt; clrscr(); do { cout cout...

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 cout cout cin>>n; cout 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 for(int i=0;i cout } void quicksort::swap(int &a,int &b) { int t; t=a; a=b; b=t; } void quicksort::qsort(int left,int right) { if(left { int pivot=median(left,right); int i=left,j=right-1; for(;;) { while(a[++i] while(pivot if(i swap(a[i],a[j]); else break; } if(i swap(a[i],a[right-1]); ...

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 cout cout cout 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 cin>>choice; } getch(); } void linkedlist::create(node *list) { cout cin>>list->number; if(list->number==0) { list->next=NULL; } else { list->next=new node; create(list->next); } return; } void linkedlist :: print(node *list) { if(list->next!=NU...

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 >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 next; cout data; delete nodeptr; } } template void stack ::display() { object item; node*nodeptr; if(TOS==NULL) cout data; nodeptr=nodeptr->next; } } } void main() { stack stack; int opt; char ch; clrscr(); do { cout >opt; switch (opt) { case 1:stack.push(); break; case 2:stack.pop(); break; case 3:stack.display(); break; case 4: exit(0); default:cout } } while(opt!=4); }

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 cout cin>>opt; switch(opt) { case 1: cout cin>>s3; cout break; case 2: cout cin>>s1; cout strcpy(s2,s1); cout break; case 3: cout cin>>s1>>s2; cout break; case 4: cout cin>>s1>>s2; if(strcmp(s2,s1)=='\0') { cout } else { cout } break; default: cout break; } cout cin>>choice; } getch(); }

STUDENT DETAILS

#include #include class student { protected: int rollno; char name[30]; public: void getdata() { cout cin>>name; cout cin>>rollno; } void putdata() { cout cout } }; class test:public student { protected: int l,m1,m2,m3; public: void getmarks() { cout cin>>m1>>m2>>m3; } void putmarks() { cout cout cout } }; class result:public test { protected: int total; float avg; public: void display() { total=m1+m2+m3; avg=total/3; cout cout cout cout cout cout cout cout } }; void main() { clrscr(); result r; r.getdata(); r.getmarks(); r.display(); getch(); }

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 cin>>a; cin>>b; int t; t=a; a=b; b=t; cout } void swap::ref(int &a,int &b) { cout cin>>a; cin>>b; int t; t=a; a=b; b=t; cout } void swap::addr(int *a,int *b) { cout cin>>*a; cin>>*b; int t; t=*a; *a=*b; *b=t; cout } void main() { int a,b,opt; swap sp; clrscr(); do { cout cout cout cout cin>>opt; switch(opt) { case 1:sp.value(a,b); break; case 2:sp.ref(a,b); break; case 3:sp.addr(&a,&b); break; case 4:break; } } while(opt!=4); getch(); }

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 cout } }; class tria:public shape { void disp() { cout cout } }; class cir:public shape { void disp() { cout cout } }; int main() { float x,y,z; clrscr(); cout 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; }