Posts

DSPS: CDLL

//============================================================================ // Name        : cdll.cpp // Author      : Parashar // Version     : // Copyright   : Do not try this at home ;P // Description : Hello World in C++, Ansi-style //============================================================================ #include <iostream> using namespace std; class cdll     {       public:            struct node              {                int data;                struct node *next,*prev;              }*head;       public:          ...

DSPS: TIC TAC TOE

//============================================================================ // Name        : Tic_tac.cpp // Author      : Parashar // Version     : // Copyright   : Do not try this at home ;P // Description : Hello World in C++, Ansi-style //============================================================================     #include <iostream>     using namespace std;     class tictactoe     {     public:         char block[10];     public:         tictactoe();         int checkwin() ;         void board();     };     tictactoe::tictactoe()     {         block[1]='1';     ...

DSPS: Print* (pattern)

//============================================================================ // Name        : print_pattern.cpp // Author      : Parashar // Version     : // Copyright   : Do not try this at home ;P // Description : Hello World in C++, Ansi-style //============================================================================ #include <iostream> using namespace std; class star { public:     void pattern(); }; void star::pattern() {     char star='*';     for(int i=1;i<=5;i++)     {         for(int j=1;j<=i;j++)         {         cout<<star;         }         cout<<endl;     } } int main() {     cout ...

DSPS: ODD 'o' EVEN

//============================================================================ // Name        : Odd_even.cpp // Author      : Parashar // Version     : // Copyright   : Do not try this at home ;P // Description : Hello World in C++, Ansi-style //============================================================================ #include <iostream> using namespace std; class number { public:     int a,c; public:     void getdata();     void process(); }; void number::getdata() {     cout<<"enter a number";     cin>>a; } void number::process() {     c=a%2;     if(c==0)     {         cout<<"the number is even";     }     else     {      ...

DSPS: add consecutive numbers(upto n)

//============================================================================ // Name        : incremental_addition.cpp // Author      : Parashar // Version     : // Copyright   : Do not try this at home ;P // Description : Hello World in C++, Ansi-style //============================================================================ #include <iostream> using namespace std; #define n 10 class add { public:     int a,i; public:     void incadd(); }; void add::incadd() {     int total=0;     for(i=1;i<=n;i++)     {         total=total+i;     }     cout<<total; } int main() {     cout << "!!!Made by PARASHAR!!!" << endl;     add a;     a.incadd();   ...

DSPS: Dictionary(word+meaning)

#include <iostream> #include<string.h> using namespace std; class node { public:     char word[10];     char meaning[10];     node *left;     node *right; }; class tree { public:     node *root,*n; public:     tree();     void create();     void insert(node*,node*);     void search(node*);     void inorder(node*);     void del(node*); }; tree::tree() {     root=NULL; } void tree::search(node *temp) {     char key[10];     cout<<"enter the word u wanna search";     cin>>key; int found=0;     do      {       if(strcmp(temp->word,key)==0)       {           found=1;      ...

DSPS: tree(char)

//============================================================================ // Name        : char_tree.cpp // Author      : Parashar // Version     : // Copyright   : Do not try this at home ;P // Description : Hello World in C++, Ansi-style //============================================================================ #include <iostream> #include<string.h> using namespace std; class node { public:     char data[10];     node *left;     node *right; }; class tree { public:     node *root,*n; public:     tree();     void create();     void insert(node*,node*);     void inorder(node*);     void preorder(node*);     void postorder(node*); }; tree::tree() {     root=NULL; } void tree::c...